日期:2014-05-17 浏览次数:20462 次
select (select isnull(cast(sum(Money) as numeric(10,2)),0) from WayInfos where InfosID=Infos.ID and WayClassID=1 and WaySortID=1) as Money1,
(select isnull(cast(sum(Money) as numeric(10,2)),0) from WayInfos where InfosID=Infos.ID and WayClassID=2 and WaySortID=1) as Money2,
cast(Money as numeric(10,2)) as Money3
FROM Infos
where Infos.Name='张三' ORDER BY Infos.ID DESC
Money1 Money2 Money3
2.00 2.00 4.00
1.00 0.00 1.00
3.00 2.00 5.00
1.52 2.48 4.00
Money1 Money2 Money3
2.00 2.00 4.00
1.00 0.00 1.00
3.00 2.00 5.00
1.52 2.48 4.00
合计Money1:7.52
合计Money2:6.48
合计Money3:14.00