...

View Full Version : SQL Query order by question



tcadieux
01-30-2007, 03:43 PM
I have a table that has 1-365 (1 entry for every day of the year) listed, I was just asked to add the word AIRED nad NOT AIRED to this table. I need the 2 above text to appear first, then the numbers in numerical order, any idea how i can do this..ie.,

Aired
Not Aired
1
2
3
4
5
etc..

My current query is
sEpisode="SELECT EpisodeID, Episode FROM Episode ORDER BY EpisodeID ASC "

angst
01-30-2007, 03:47 PM
if i understand you correctly, this is just an ORDER question ( should really been in the sql forum ),

try:


ORDER BY AIRED ASC, NOT_AIRED ASC, EpisodeID ASC


notice the order of operation.

tcadieux
01-30-2007, 04:04 PM
Thanx, i'll try that...

As for the forum, there's only a MySql Forum, not ms SQL ?

angst
01-30-2007, 04:08 PM
try "Other Databases"

http://www.codingforums.com/forumdisplay.php?f=38

tcadieux
01-30-2007, 04:35 PM
Will do in future, thx



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum