Friday, April 10, 2009

I Canz haz Ur Nullz at Bottom?

SQL Server when doing ORDER BY will put rows with null values in the sort column at the top - of course a simple adjustment to your ORDER BY can fix that:

SELECT *
FROM cheezburgers
ORDER BY CASE WHEN position IS NULL THEN 1 ELSE 0 END, position
view raw gistfile1.sql hosted with ❤ by GitHub


Aloha on Rails is coming! I'll blog a bit more about this in the future but this should be a great conference with great sessions and Waikiki Beach just across the street!