热线电话:13121318867

登录
2019-02-25 阅读量: 734
sql高效查询的问题

问题描述:

表中有xx_id、time和type两个字段

查询xx_id相同并对应type为0,1 time时间相差10分钟内的个数,怎么组织sql最高效?

解决方法:

$time = time() - 600;

select xx_id,count(xx_id) count from tablename where type = 1 and time > $time group by xx_id;

0.0000
2
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子