I want to see which user has received the most highfives using a SQL query. My table looks like following, id | uid | ip
. Now, I want to count the amount of rows a uid
has, but it has to be unique with the ip
. So nobody can give multiple highfives to a person.
I searched around online, and I couldn’t find anything about this. If anyone could help me with this, I would be grateful.
2
Answers
you can try like below
I think this will give you perfect vote counting. Using Row Number actively remove duplicates from same ip,same uid. Voting to multiple uid from same ip is allowed in this query.