I have an SQL query that looks like this:
SELECT DISTINCT UserId, PoliticianId
FROM Votes
WHERE UserId= 1010
The result looks like this:
UserId | PoliticianId
1010 3
1010 10
1010 35
Is there a way to get number of rows returned by this query?
I’ve tried with COUNT(*) but it didn’t work, probably because I’ve done the
query wrong.
I know I could just retrieve all the rows and count them on the server but I want to avoid that.
All these rows have the same
UserIdbut differentPoliticianIdso you can useCOUNT(DISTINCT column):