insert into tab(field1,field2,...)
values(value1,value2,...)insert into tab(fied1,fied2...)
(select ... from ... where ...)

解决方案 »

  1.   

    利用子查询的SQL语句是不需要values这个关键字的。
      

  2.   

    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))