insert into Sc_procsalary(accountid,Stepid,worker,salarydt,qty,stepprice,amount) (select H.AccountId,B.stepid,B.worker,substr(B.workdt,1,7) as SalaryDt,sum(B.qty),B.stepprice,sum(B.qty)*stepprice as Amount from SC_stepflowbody B,Sc_stepFlowHead H where B.listno=H.listno and substr(workdt,1,7)='2002/06' group by H.AccountId,B.stepid,B.stepprice,B.worker,substr(B.workdt,1,7))
(select H.AccountId,B.stepid,B.worker,substr(B.workdt,1,7) as SalaryDt,sum(B.qty),B.stepprice,sum(B.qty)*stepprice as Amount
from SC_stepflowbody B,Sc_stepFlowHead H
where B.listno=H.listno and substr(workdt,1,7)='2002/06'
group by H.AccountId,B.stepid,B.stepprice,B.worker,substr(B.workdt,1,7))