Friday, February 18, 2011

Grouping items in Order By Statement

I like this!!!

...
ORDER BY
CASE WHEN column = 'this' THEN 2 ELSE 1 END asc,
othercolumn asc,
another column desc
...

to group items separately and then apply a secondary sorting within each group...