结构表:
date (datetime)
ip (varchat,50)
我有疑问
SELECT * FROM Table GROUP BY ip Order by date Desc
请告诉我如何在几天内选择一个独特的ip(每天1个独特的ip)?
我需要获得下一个结果:
2013-02-14 17:14:25 31.132.154.142.
2013-02-14 17:15:01 31.132.154.142.
2013-02-13 16:40:47 31.132.154.142.
我需要每天获得独特的IP
答案 0 :(得分:1)
SELECT DISTINCT(ip) FROM Table GROUP BY date Order by date Desc
答案 1 :(得分:0)
SELECT MAX(`date`),`ip` FROM Table GROUP BY `ip`,DATE(`date`)
<强> END 强>