NitroFrost
NitroFrost

Reputation: 153

SQL Order By two columns different ways in the same table.

So I have seen a lot of examples and I just am not getting the deserved results. My table has a name column and then a (bool) activation column. I want to sort alphabetically ASC and then I want all the active on top so activation DESC.

ORDER BY [eventName] ASC, [eventActivation] DESC

the results of this I want should be

NAME | ACTIVATE
Ash      1
Jerry    1
Sam      1
Bruce    0
David    0

but I don't get this instead I get the results in only alphabetical.

Any help on this one? From everything I have seen it seems as though I am doing this right but I have to be missing something. Do I have to group by first? Any help would be greatly appreciated

Upvotes: 1

Views: 1554

Answers (1)

SQLMenace
SQLMenace

Reputation: 134933

Should be

ORDER BY [eventActivation] DESC, [eventName] ASC

Upvotes: 2

Related Questions