I have the following list of items
| Category | OrderNum |
|---|---|
| Prerequisites | 2 |
| NULL | 4 |
| Prerequisites | 6 |
| Sign Off | 8 |
| Sign Off | 10 |
I would like it to be ordered so that 'Prerequisites' is together and the NULL category appears after it, so that:
| Category | OrderNum |
|---|---|
| Prerequisites | 2 |
| Prerequisites | 6 |
| NULL | 4 |
| Sign Off | 8 |
| Sign Off | 10 |
Currently my SQL has the following order by:
ORDER BY OrderNum <> '' DESC, OrderNum
I've tried the following, however it puts NULL at the end.
ORDER BY COALESCE(Category,'') <> '' DESC, OrderNum <> '' DESC, OrderNum
I'm trying to achieve it so that the records with the same category are together in the recordset, the NULL item should appear before the 'Sign Off' category because the OrderNum of NULL is less than any of the 'Sign Off' records.
I'm not sure if that's possible in one query. Any help would be appreciated.
Thanks!