I have a table with two fields. One field is a number 0 or 1. The other field is an ID.
I would like to select the IDs ordered by the occurrences of the field with number 1.
Say if I have:
B 1
B 1
B 0
A 1
A 0
The query should order it B than A because B has the most occurrences of 1.
How would I do that? I'm guessing that I need to create some temporary variable.