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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ORDER BY when datetime is NULL

Status
Not open for further replies.

medmed

IS-IT--Management
Mar 12, 2005
26
CH
Hi all,

i have a table relA with a datetime column ADate. this column can contain a value or NULL. Now, i would like to sort the rows as follow:

SELECT * FROM relA
ORDER BY ADate;

Now, the rows with an NULL date appear on the top. How can I change it to appear rows with NULL date value at the bottom?I don't have a clue anymore...

Many thanks for any hint
Dani
 
Code:
order by
	isnull(Date_Field, DateAdd(yy, 200, GetDate()))

...or similar

Rhys
The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense Edsgar Dijkstra
If life were fair, Dan Quayle would be making a living asking 'Do you want fries with that?' John Cleese
 
thanks a lot!
hint from swampBoogie worked perfectly

Cheers
Dani
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top