(select count(id) as count_neg,name from score2 where score <=60 group by name) b where a.name=b.name 即必須至少用2個(gè)語(yǔ)句。 今天剛好碰到發(fā)現(xiàn)mysql支持if,那就創(chuàng)造性的用if來(lái)實(shí)現(xiàn)吧: 復(fù)制代碼代碼如下: select name, sum(if(score>=60,1,0)),sum(if(score<60,1,0)) from score2 group...
www.dbjr.com.cn/article/495...htm 2025-6-1