Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Beginner
Nov 11, 2003

Sorting Null Fields Last

If you sort a table from a field which has null values, Null values are typically displayed first.

Here is a way to display the NULL values at last.


Use NorthWind
GO
Select * from employees
order by
case when reportsTo   is null then 1
	 	         Else 0
		      end,
reportsTo
Dinesh Asanka
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date