通过以下方式提供表格
ID, IP, DATE, TIME
以下查询按每天的小时数统计访问者人数。
SELECT DATE, CONCAT(TIME_FORMAT(TIME, "%H"), ":00") AS TIME, COUNT(*) AS COUNT
FROM statistiche
WHERE date = CURRENT_DATE()
GROUP BY DATE, CONCAT(TIME_FORMAT(TIME, "%H"), ":00")
现在,我想排除多个特定IP引发此查询,但是我找不到使用NOT IN
的正确方法。以下内容不起作用:
SELECT IP, DATE, CONCAT(TIME_FORMAT(TIME, "%H"), ":00") AS TIME, COUNT(*) AS COUNT
FROM statistiche WHERE date = CURRENT_DATE()
GROUP BY DATE, CONCAT(TIME_FORMAT(TIME, "%H"), ":00")
AND IP NOT IN ('185.34.12.178', '158.101.217.81')