sql把查詢結果作為條件進行查詢


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

參考鏈接https://blog.csdn.net/zsg88/article/details/78862852

 

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

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

 

=====================================================

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM