数据格式是这样的,两个字段,一个是id,一个是time,写个sql列出今天所有出现过3次以上的id,id不是索引。
解决方案 »
- meta问题
- ★ ★ ★ ★ 读《PHP5 使用Zend Framework & Smarty 构筑真正的MVC应用模式》 ★ ★ ★ ★
- 满分急求高手帮忙,急死了啦,解决了还加分。。。。。。。。。。。。。
- PHP中.htaccess Rewrite的问题
- text文档导入题库
- 哪位好心大哥帮帮小弟解决下问题
- php连接数据出错 Access denied for user 'ODBC'@'localhost' (using password: NO)
- session的问题
- 大家做OA一般把表放在一个库还是多个库?
- pph与mysql数据库查询出的值怎么放到多维数组里
- SQL语句出错
- php中如何把内容里的空格替换成百分号 %
select id,date(time),count(*)
from tablename
where time>=current_date()
group by id,date(time)
having count(*)>=3
(select id,sum(id) as total from
table
where time=curdate()
group by id)
where total>3;
from tablename
where time>=current_date()
group by id
having count(*)>=3
;where那边用>=, 因为我假定你的time是datetime/timestamp类型
from tb
where datediff(dd,[time],getdate())=0
group by id
having count(1)>=3
from table
where time like curdate()
group by id
having count(*)>=3;三楼的代码用模糊查询更准确点吧!
SELECT `id` FROM table WHERE FROM_UNIXTIME(`time`)=CURDATE() GROUP BY `id` HAVING COUNT(1) > 3