There is an enter table with id, uid, date fields.
You need to extract 5 uid , which occur most often, from the most common, and, accordingly, another 4, inferior to the first.
How can this be implemented? I myself cannot reach any ideas.
Will return the 5 most common uid and number of times they met in the count table
select count(uid) as count, uid from enter group by uid order by count desc limit 5 id in select , you need uid . - MajestioLike this (tried for for MySQL):
SELECT u.uid, COUNT(u.uid) FROM enter AS u GROUP BY u.uid ORDER BY COUNT(u.uid) DESC LIMIT 5 Source: https://ru.stackoverflow.com/questions/623247/
All Articles