你不一定知道的按条件 count 获取mysql记录数的方式
mysql 按条件 count 获取记录数的三种方式,统计sub_type='REFUND_FEE’ 的记录数:
方法一.select count(sub_type) from t where t.sub_type='REFUND_FEE’;
常规where条件来实现 count
方法二.select sum(if( B.sub_type='REFUND_FEE’ ,1,0)) from t;
使...
转载
2019-06-11 21:20:16 ·
493 阅读 ·
0 评论