MySQL Query Ranking
- by eft0
Hey there, I have this MySQL query for list a "Vote Ranking" for "Actions" and it work fine, but I want what the "id_user" doesn't repeat, like made a "DISTINCT" in this field.
SELECT
count(v.id) votos,
v.id_action,
a.id_user,
a.id_user_to,
a.action,
a.descripcion
FROM
votes v,
actions a
WHERE
v.id_action = a.id
GROUP BY
v.id_action
ORDER BY
votos DESC
The result:
votes act id_user
3 3 745059251
2 20 1245069513
2 23 1245069513
2 26 100000882722297
2 29 1245069513
2 44 1040560484
2 49 1257441644
2 50 1040560484
The expected result
votes act id_user
3 3 745059251
2 20 1245069513
2 26 100000882722297
2 44 1040560484
2 49 1257441644
2 50 1040560484
Thanks in advanced!