When I order dates, sql puts nulls as the lowest value, but C# rdlc puts a null as the highest value. How do I solve it?
Asked
Active
Viewed 94 times
0
-
1Google is your friend :) http://stackoverflow.com/questions/821798/order-by-date-showing-nulls-first-then-most-recent-dates – AlbertVo Nov 10 '15 at 22:19
-
What is the column you are sorting data type? – Black Frog Nov 10 '15 at 22:21
1 Answers
2
ANSI SQL and some databases support the NULLS FIRST
/NULLS LAST
keywords, just for this purpose.
Otherwise, you can use explicit logic in a SQL query:
order by (case when col is null then 1 else 2 end),
col

Gordon Linoff
- 1,242,037
- 58
- 646
- 786