M
myjane
Unregistered / Unconfirmed
GUEST, unregistred user!
如果ysskmx中有N条相同的记录,在求和时所得结果就是N个XSJE的和.
with hzado do
begin
close;
sql.Clear;
sql.add('select ss.khdm,ss.khmx,sum(ss.xsje) as qhk,yy.khdm,yy.khmx,sum(yy.skje) as qh');
sql.add('from ysskmx yy,ysxsmx ss');
sql.add('where yy.khdm=ss.khdm)');
sql.add('GROUP BY ss.khdm,ss.khmx,yy.khdm,yy.khmx');
open;
end;
with hzado do
begin
close;
sql.Clear;
sql.add('select ss.khdm,ss.khmx,sum(ss.xsje) as qhk,yy.khdm,yy.khmx,sum(yy.skje) as qh');
sql.add('from ysskmx yy,ysxsmx ss');
sql.add('where yy.khdm=ss.khdm)');
sql.add('GROUP BY ss.khdm,ss.khmx,yy.khdm,yy.khmx');
open;
end;