E
eileen2004
Unregistered / Unconfirmed
GUEST, unregistred user!
我有汇总语句如下:<br>str:='select Department,COUNT(DISTINCT Enum) rs,SUM(GWpay) gwpay,SUM(SHpay) shpay,SUM(GLpay) glpay, ';<br>str:=str+' SUM{Qyjt) qyjt,SUM(Gwjt) gwjt,SUM(Gzbt) gzbt,SUM(Bfgz) bfgz,';<br>str:=str+' SUM(Bsjk) bsjk,SUM(Flbt) flbt,SUM(Gzflhj) gzflhj,SUM(Kfz) kfz,';<br> str:=str+' SUM(Kdf) kdf,SUM(Zfgjj) zfgjj,SUM(Kghf) kghf ,SUM(Yldy) yldy,SUM(Ylbx) ylbx,SUM(Qtkk) qtkk,SUM(Ks) ks,SUM(Kkxj) kkxj,SUM(Sfgz) sfgz ';<br>str:=str+' from Zzpay_history where left(Pdate,7)>='+''''+kstime+'''';<br>str:=str+' and left(Pdate,7)<='+''''+jstime+''''; //Pdate 是表示日期 <br>str:=str+' and Unit<>'+'公司科室'; //Unit表示单位<br>str:=str+' and Unit<>'+'公司领导 ';<br>str:=str+' group by Department'; //Department表示部门<br>with DataModule2.gzhzQuery do<br>begin<br>active:=false;<br>sql.clear;<br>sql.add(str);<br>active:=true;<br><br>上面这个查询代码我放到SQLServer的查询分析器里测试,是成功的,为什么在DELphi里运行是出现错误提示: <br> Project Project1.exe raised exception class EOLeException with message'语法错误或访问冲突',Process stopped,use Step or Run to continue<br> 请各位大虾帮帮忙!指点一下!!感激不尽!