select count(fcustomernames) from T_SHE_Purchase p
left join T_SHE_Room r on p.froomid=r.fid and p.fstate='4AUDITTED'
where r.fbuildingarea<48
select count(fcustomernames) from T_SHE_Purchase p
left join T_SHE_Room r on p.froomid=r.fid and p.fstate='4AUDITTED'
where r.fbuildingarea>=48 and r.fbuildingarea<55怎么把这两个拼成一个
left join T_SHE_Room r on p.froomid=r.fid and p.fstate='4AUDITTED'
where r.fbuildingarea<48
select count(fcustomernames) from T_SHE_Purchase p
left join T_SHE_Room r on p.froomid=r.fid and p.fstate='4AUDITTED'
where r.fbuildingarea>=48 and r.fbuildingarea<55怎么把这两个拼成一个
count(case when r.fbuildingarea<48 then 0 else 1 end) as c2
from T_SHE_Purchase p
left join T_SHE_Room r on p.froomid=r.fid and p.fstate='4AUDITTED'
count(case when r.fbuildingarea>=48 and r.fbuildingarea<55 then 1 else 0 end) as c2
from T_SHE_Purchase p
left join T_SHE_Room r on p.froomid=r.fid and p.fstate='4AUDITTED'
count(case when r.fbuildingarea>=48 and r.fbuildingarea<55 then 1 else 0 end) as c2
from T_SHE_Purchase p
left join T_SHE_Room r on p.froomid=r.fid and p.fstate='4AUDITTED'
select
(case when r.fbuildingarea<48 then count(fcustomernames) else 0 end )
(case when r.fbuildingarea>48 then count(fcustomernames) else 0 end )
from T_SHE_Purchase p
left join T_SHE_Room r on p.froomid=r.fid and p.fstate='4AUDITTED'
这语法有问题,怎么改写下
count(case when r.fbuildingarea<48 then 1 else 0 end) as c1,
count(case when r.fbuildingarea>=48 and r.fbuildingarea<55 then 1 else 0 end) as c2
from
T_SHE_Purchase p
left join
T_SHE_Room r
on
p.froomid=r.fid
and
p.fstate='4AUDITTED'
sum(case when r.fbuildingarea>=48 and r.fbuildingarea<55 then 1 else 0 end) as [介于48-55之间]
from T_SHE_Purchase p
left join T_SHE_Room r on p.froomid=r.fid and p.fstate='4AUDITTED'