2019-02-25
閱讀量:
750
sql高效查詢的問題
問題描述:
表中有xx_id、time和type兩個字段

查詢xx_id相同并對應(yīng)type為0,1 time時間相差10分鐘內(nèi)的個數(shù),怎么組織sql最高效?
解決方法:
$time = time() - 600;
select xx_id,count(xx_id) count from tablename where type = 1 and time > $time group by xx_id;






評論(0)


暫無數(shù)據(jù)
推薦帖子
0條評論
0條評論
0條評論
1條評論