看看这条语句错在哪里?
select
min(case when jysj>='2005/11/01' and jysj<='2005/11/30' then lcb end) as sqlc,
max(case when jysj>='2005/11/01' and jysj<='2005/11/30' then lcb end) as bqlc,
sum(case when jysj>='2005/11/01' and jysj<='2005/11/30' then convert(numeric(20,2),lcb)
when jysj>='2005/11/01' and jysj<='2005/11/30' then -convert(numeric(20,2),lcb)
end) as bqxs,
sum(case when jysj>='2005/11/01' and jysj<='2005/11/30' then convert(numeric(20,2),jyl)
when jysj>='2005/11/01' and jysj<='2005/11/30' then -convert(numeric(20,2),jyl)
end) as bqyy,
a.cldm
from
car_jyxx a
where
exists(select 1 from car_clxx where cldm=a.cldm)
group by
a.cldm
执行后得到的bqxs的值应该是bqlc减去sqlc的值,可是怎么得到的是两个相加的值呢?帮忙啊!