查询同一张表里同一个字段值的和以及状态是2(或1)时,该字段值的和
SQL语句:
select a.sum allLength, b.sum length
from
(select 1 as t, SUM(length) as sum from t_base_cabinet) a,
(select 1 as t, SUM(length) as sum from t_base_cabinet where status=2) b
where a.t = b.t