Answer the question
In order to leave comments, you need to log in
How to make a selection in the database by key?
There is a table, how to find a user for a day who has more rows in the table?
SELECT * FROM `cover_wid_comments` WHERE `id_group` = 150444045
id_group=150444045
, the user id isfrom_id
Answer the question
In order to leave comments, you need to log in
SELECT `from_id`
FROM `table`
WHERE `date` >= NOW() - INTERVAL 1 DAY
AND `id_group` = :group
GROUP BY `from_id`
ORDER BY COUNT(*) DESC
LIMIT 1
In MySQL dialect like this
SELECT `from_id`, COUNT(`from_id`) as 'posts'
FROM `cover_wid_comments`
WHERE DATE_ADD(`date`, INTERVAL 1 DAY) > NOW() AND `id_group`=150444045
GROUP BY `from_id`
ORDER BY count(`from_id`) DESC
LIMIT 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question