Query help

wxdqz

New Member
Say I have a database like so:

adId, userName
1, matt
2, matt
3, pat
4, matt
5, pat

And I want my query to return every record but ordered by the userName that appears most. So maybe my query would return...

adId, userName, numAds
1, matt, 3
2, matt, 3
4, matt, 3
3, pat, 2
5, pat, 2

userName matt appears 3 times so all records with userName matt come first, and userName pat appears 2 times so all his records come after matt.

note: I don't really need the numAds field but I thought it might help explain what I mean.
 
Back
Top