Archives of the TeradataForum
Message Posted: Fri, 29 Jul 2005 @ 15:35:11 GMT
NULLS LAST|FIRST is part of SQL:2003, probably suggested by Oracle ;-)
No, but would be nice as an Enhancement Request.
Teradata sorts NULL as lowest value:
order by col asc NULLS FIRST -> order by col asc order by col desc NULLS LAST -> order by col desc
Instead of thinking about the right value to use in coalesce you can calculate an extra column:
order by col asc NULLS LAST -> order by case when col is null then 1 else 0 end, col asc order by col desc NULLS FIRST -> order by case when col is null then 0 else 1 end, col desc
Of course the extra sort column will need more spool space...
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|