Mysql
 sql >> Database >  >> RDS >> Mysql

come ottenere il conteggio dei valori in MySQL

Se i tuoi dati non sono troppo grandi, puoi usare questo trucco in MySQL:

select user_id, max(dte),
       substring_index(group_concat(place_visited order by cnt desc), ',', 1)
from (select user_id, place_visited, count(*) as cnt, max(recorded_date) as dte
      from user_places
      group by user_id, place_visited
     ) upv
group by user_id;