'SELECT 'from', 'to', count(*) AS num_clicks
FROM my_rank
WHERE my_rank_data
BETWEEN "'.$yesterday.'" AND "'.$today.'"
ORDER BY num_clicks DESC LIMIT 0,20';
Above I'm trying to get the "from" and "to" fields from a table, but I only want the last 24h lines, and I need to return only the 20 most repeating lines of those 24h. But the above result returns the lines that are not the ones that repeat the most in the range of given dates.