Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order by + Case

Status
Not open for further replies.

vlitim

Programmer
Sep 2, 2000
393
0
0
GB
I am using the below query to order by date so if there is no date they are grouped together

SQL="SELECT *, orderbyWhat = CASE dueDate WHEN Null THEN 3 WHEN '' THEN 2 ELSE 1 END FROM todoList WHERE staffID="&session("staffID")&" AND (DateAdd(hh,12,completeDate) >= getDate() OR completeDate is null) ORDER by orderbyWhat"

bu what I get is

30 Sep 03
(Null)
07 Oct 03

Whereas what I would like is:

30 Sep 03
07 Oct 03

(Null)

what am I doing wrong??
Cheers
Tim
 
Why use the case? I would just do this:

SQL="SELECT * FROM todoList WHERE staffID="&session("staffID")&" AND (DateAdd(hh,12,completeDate) >= getDate() OR completeDate is null) ORDER by orderbyWhat"

Hope It Helps
 
because it put the null values first wheras i want it to display

30 Sep 03
07 Oct 03
Null
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top