How do i get the most repeated value that is inserted just today from 23:59 till 00:00 i have this sql but i dont know how to filter it by date any help will be apreciated.

$sql = "SELECT `MatchTitle`, COUNT(`MatchTitle`) AS `mostPlayed` FROM `matches` GROUP BY `MatchTitle` ORDER BY `mostPlayed` DESC LIMIT 1";

Hi, you can try with the BETWEEN ... AND construct in the WHERE clause:

Example with date_column:

"SELECT `MatchTitle`, COUNT(`MatchTitle`) AS `mostPlayed` FROM `matches` WHERE `date_column` BETWEEN "2016-05-24 23:59:00" AND "2016-05-25 00:00:00" GROUP BY `MatchTitle` ORDER BY `mostPlayed` DESC LIMIT 1"

This will give 1 minute range. Just change date ranges according to your needs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.