Skip to main content
September 25, 2006
Question

order by

  • September 25, 2006
  • 2 replies
  • 353 views
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
This topic has been closed for replies.

2 replies

Inspiring
September 25, 2006
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...
Inspiring
September 25, 2006
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 ##...
September 25, 2006
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>
Inspiring
September 25, 2006
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.