select count(*) from db1 where grade = 0;
select count(*) from db1 where grade = 1;
select count(*) from db1 where grade = 2;
select count(*) from db1 where grade = 3;
以上4条sql,合成一条可以实现吗?
为什么在mysql中可以这样实现:
SELECT (SELECT COUNT(*) FROM db1 WHERE gread = 1) AS g1,(SELECT COUNT(*) FROM db1WHERE gread = 2) AS g2;
而DB2中不可以。。。