• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

order by

Guest
Sep 24, 2006 Sep 24, 2006

Copy link to clipboard

Copied

Hi i have a dynamic list box, what i need to do is order the list box by SeasonID Desc

i have tried the standard order by but with no luck

any ideas
TOPICS
Advanced techniques

Views

269

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 25, 2006 Sep 25, 2006

Copy link to clipboard

Copied

add ORDER BY SeasonID DESC on a new line after WHERE clause in your query.

btw, what is 'Season' (which you use in the WHERE SeasonID = Season)? If it is a variable you pass to your query, you better surround it with ##...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 25, 2006 Sep 25, 2006

Copy link to clipboard

Copied

yes i have tried that but dont work, there are two tables that i am joining, thats why i am getting no order by

<cfquery name="ShowDate" datasource="Cricket">
SELECT DISTINCT SS.SeasonID, SS.SeasonYear, BB.Season
FROM SeasonTable SS, BattingStats BB
WHERE SS.SeasonID = BB.Season
</cfquery>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 25, 2006 Sep 25, 2006

Copy link to clipboard

Copied

LATEST
quote:

Originally posted by: JohnGree
yes i have tried that but dont work, there are two tables that i am joining, thats why i am getting no order by

<cfquery name="ShowDate" datasource="Cricket">
SELECT DISTINCT SS.SeasonID, SS.SeasonYear, BB.Season
FROM SeasonTable SS, BattingStats BB
WHERE SS.SeasonID = BB.Season
</cfquery>


Based on what you are showing us, the reason you are not getting an order by is because you are not typing it into your query.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 25, 2006 Sep 25, 2006

Copy link to clipboard

Copied

have you tried using INNER JOIN in your query instead?

SELECT DISTINCT SS.SeasonID, SS.SeasonYear, BB.Season
FROM SeasonTable SS INNER JOIN BattingStats BB ON SS.SeasonID = BB.Season
ORDER BY SS.SeasonID DESC

i am not quiet sure if you can use table aliases with INNER JOIN.. so you may have to use full table names instead if the above does not work...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation