Reputation: 117
I have this table:
Aid id date
--------------
1 1 19/12
2 1 20/5
3 2 30/2
I want to get the id that is showing the most so in this case I want to get 1 (SELECT id)...
Should be like this:
id
1
I just want to get the max of count id
Upvotes: 0
Views: 39
Reputation: 117
SELECT TOP 1 ArtistID
FROM AwardToArtis
group by ArtistID
order by ArtistID desc
thats solve it for me
Upvotes: 0
Reputation: 2050
SELECT TOP 1 id from
(SELECT id, COUNT(id) AS freq FROM table1
GROUP BY id) t1
ORDER BY t1.freq desc
Here is the SQLFiddle
Upvotes: 3