MySQL Query Ranking -


i have mysql query list "vote ranking" "actions" , work fine, want "id_user" doesn't repeat, made "distinct" in field.

select count(v.id) votos,  v.id_action, a.id_user, a.id_user_to, a.action, a.descripcion     votes v,     actions     v.id_action = a.id group     v.id_action order     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 

if don't want duplicate users, should group a.id_user only. have aggregate actions, may want sum(a.action) or count(a.action) in place of a.action. it's hard tell should use without knowing 'action' represents.


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -