mysql - 按條件統計


在表中分別統計mt =0 和 mt>0 的個數

方法一:select count(if(mt=0,1,null)) as a,count(if(mt>0,1,null)) as b from table

方法二:select sum(mt=0) as a,sum(mt>0) as b from table

 


免責聲明!

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



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