Mysql查询列表结果匹配每个日期

时间:2011-06-20 16:42:15

标签: mysql

不确定这是如何工作的。我有一个查询之间,但我如何运行查询以列出每天匹配的结果。例如,存在于2011-06-17,2011-06-18,2011-06-06和2011-06-20的enterys

SELECT lookup, `loc`, `octect1` ,`octect2` ,`octect3` ,`octect4`, date, time, count(`lookup`) as count FROM index 
WHERE date between '2011-06-17' AND '2011-06-20'
GROUP BY lookup
ORDER BY count DESC

由于

1 个答案:

答案 0 :(得分:1)

使用比较运算符代替BETWEEN

SELECT lookup, `loc`, `octect1` ,`octect2` ,`octect3` ,`octect4`, 
       date, time, count(`lookup`) as count 
FROM index  
WHERE date > '2011-06-17' AND date < '2011-06-20' 
GROUP BY lookup 
ORDER BY count DESC