17,377
社区成员
发帖
与我相关
我的任务
分享
select id,mc,sum(s)
from
(select a.id id,b.mc mc,sum(b.sl*b.cs) s from a表 a,b表 b where a.1=b.1 and b.mc=XXX group by a.id,a.mc
union all
select id,,mc,sum(sl*cs+bctl) s from c表 where ……
[/Quote]
select id,mc,sum(s)
from
(select a.id id,b.mc mc,sum(b.sl*b.cs) s from a表 a,b表 b where a.1=b.1 and b.mc=XXX group by a.id,a.mc
union all
select id,,mc,sum(sl*cs+bctl) s from c表 where id=XXXX group by id,mc )
group by id,mc