开发者

Mysql query list results matching each date

Not sure how this would work. I have a between query, but how would I run a query to list results that match each and every day. Example, enterys that exists on 2011-06-17, 开发者_开发技巧2011-06-18, 2011-06-19 and 2011-06-20

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

Thanks


Instead of BETWEEN, use comparison operators:

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 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜