mysql 在查詢結果中進行二次查詢

第一次查詢:查詢身份證編號和出現次數

select cardid,count(cardid) as total from p_person_info group by cardid

在第一次查詢結果進行二次查詢:查詢身份證出現次數大於1以上

select cardid from (select cardid,count(cardid) as total from p_person_info group by cardid) temp where temp.total>1

 

發佈了371 篇原創文章 · 獲贊 1033 · 訪問量 173萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章