99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
2019-02-27 閱讀量: 732
如何查詢(xún)某字段相同數(shù)據(jù)出現(xiàn)次數(shù)大于3的信息?

如何查詢(xún)某字段相同數(shù)據(jù)出現(xiàn)次數(shù)大于3的信息?

select num ,count(num) as new_num 
from xxy_logs
group by num
where new_num>3;

[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where new_num>3' at line 4

答:where 關(guān)鍵字不能和group by 一起使用的(主要是不能放在group by 之后,不能作用于聚合后的數(shù)據(jù)),這時(shí)我們可以使用hiving語(yǔ)句來(lái)過(guò)濾返回的記錄集,可以按照下面的方式k來(lái)寫(xiě)。

select num ,count(num) as new_num 
from xxy_logs
group by num
HAVING new_num>3;

0.0000
2
關(guān)注作者
收藏
評(píng)論(0)

發(fā)表評(píng)論

暫無(wú)數(shù)據(jù)
推薦帖子