1. Ordinary summation:
select sum(is_img) is_img_sum from ec_assessment
2. Sum according to conditions:
select sum(if(is_img=1,1,0)) asis_img_sum from ec_assessment
白话注释:sum(如果is_img=1,那么就+1,否则就+0)
。
。
。
。
。
。
。
Afterword: After I found out that my white shoes were dirty, my partner would brush me clean, so I decided to buy only white shoes from now on.