· 7 years ago · Sep 11, 2018, 05:04 PM
1Get the highest amount of visitors grouped by date
2CREATE TABLE IF NOT EXISTS `visitors` (
3 `id` int(10) NOT NULL AUTO_INCREMENT,
4 `ipaddress` text NOT NULL,
5 `page` text NOT NULL,
6 `page_get` text NOT NULL,
7 `date_visited` datetime NOT NULL,
8 `date_lastactive` datetime NOT NULL,
9 `date_revisited` datetime NOT NULL,
10 PRIMARY KEY (`id`),
11 UNIQUE KEY `id` (`id`)
12)
13
14SELECT DATE(date_visited)
15FROM visitors
16GROUP BY DATE(date_visited)
17ORDER BY COUNT(*) DESC
18LIMIT 1
19
20select date(date_visited)
21, count(*)
22from visitors
23group by
24 date(date_visited)
25order by
26 count(*) desc
27limit 1