select count(case when a=6 then 1 else (case when b=3 then 1 else 0 end) end ) from table1
--求个数的时候条件可以放到where后面 --例如 select count(*) from table where a=1 select count(*) from table where a=2 --可以这样 select sum(case when a=1 then 1 else 0 end), sum(case when a=2 then 1 else 0 end) from tablename
是不是应该select count(case when a=6 then (case when b=3 then 1 else 0 end) else 0 end ) from table1 这样啊
from table1
--求个数的时候条件可以放到where后面
--例如
select count(*) from table where a=1
select count(*) from table where a=2
--可以这样
select
sum(case when a=1 then 1 else 0 end),
sum(case when a=2 then 1 else 0 end)
from tablename
是不是应该select count(case when a=6 then (case when b=3 then 1 else 0 end) else 0 end )
from table1 这样啊