I have an SQL query like this:
SELECT DISTINCT NewsID, UserID, PoliticianID
FROM Votes
WHERE UserID = 1010
And result looks like this:
NewsID | UserID | PoliticianID
40 1010 3
40 1010 10
38 1010 27
39 1010 27
40 1010 35
Is there a way to get number 27 from my example above with SQL?
I would like to get PoliticianID that has been voted most by a user.
You can try this
I have created a new TEMP Table that holds your query and gives you the result as required.