|
Question : Sorting NULLs last when Sort Order is Ascending
|
|
How do I sort Nulls last (against a varchar column) when Sort Order is Ascending, without replacing Nulls with a character?
Example:
SELECT * FROM T1 ORDER BY C1 ASC
Returns:
C1 ---------- NULL Apple Bananna
I need it to return:
C1 ---------- Apple Bananna NULL
THANKS!
|
|
Answer : Sorting NULLs last when Sort Order is Ascending
|
|
You can try it this way:
SELECT * FROM T1 ORDER BY ISNULL(C1, 'ZZZZZZZZZ') ASC
|
|
|