with adod_dict do begin close; commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; parameters[0].DataType:=ftstring; parameters[0].Value:=trim(cbtjnd.Text); open; end;
以上是delphi中的语句,ORACLE数据库,运行时,老是报ora-00979 不是 group by 表达式?
若数据库换成 SQL SERVER就能正常运行! 你那条SQL语句是标准的SQL又不是PL/SQL不至于在Oracle DB就不行了吧,而且那条语句也没错啊 with adod_dict do begin close; commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd='+quotedstr(cbtjnd.Text)+' group by bgqxcode'; open; end;
这样试试 with adod_dict do begin close; commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd='+''''+trim(cbtjnd.text)+''''+' group by bgqxcode'; open; end; 改成以上是可以正确运行,为什么加参数就不行呢?