select
B.intYear,
sum(A.amount),
sum(case A.typeID when 55 then A.amount else 0 end)
from
A,B
where
A.prjID = B.prjID
group by
B.intYear
B.intYear,
sum(A.amount),
sum(case A.typeID when 55 then A.amount else 0 end)
from
A,B
where
A.prjID = B.prjID
group by
B.intYear
A,B where A.prjID = B.prjID group by B.intYear
from a left outer join b on a.prjid=b.prjid)aa
group by intyear
select intyear,sum(amoutnt) from (select a.*,b.*
from a left outer join b on a.prjid=b.prjid)aa
where typeid=55
group by intyear
from 表1 a,表2 b
where a.prjID=b.prjID and a.typeID = 55
group by a.intYear
from 表1 a,表2 b
where a.prjID=b.prjID and a.typeID = 55
group by a.intYear
union
select a.intYear,sum(b.amount )
from 表1 a,表2 b
where a.prjID=b.prjID
group by a.intYear
select
B.intYear,
sum(A.amount),
sum(case A.typeID when 55 then A.amount else 0 end)
from
A,B
where
A.prjID = B.prjID
group by
B.intYear
我用的是SQL sever 2000 用不支持case 语句这样的用法,问一下有没有其他的办法呀??