query1.close;
query1.sql.clear;
query1.sql.add(select spldate ,sum(case when splsyjid like '9%' then splxsbs1 else 0 end) "超市客数",  
sum(case when splsyjid like '9%' then splxssr else 0 end) "超市销售收入" , 
round(sum(case when splsyjid like '9%' then splxssr else 0 end)/ sum(case when splsyjid like '9%' then splxsbs1 else 0 end),2) "超市客单价",  
 sum(case when splsyjid like '8%' then splxsbs1 else 0 end) "卖场客数",
 sum(case when splsyjid like '8%' then splxssr else 0 end) "卖场销售收入", 
 round(sum(case when splsyjid  like '8%' then splxssr else 0 end)/sum(case when splsyjid  like '8%'then splxsbs1 else 0 end),2) "卖场客单价" ,
 sum(splqtsr) "其它销售收入",
 sum(splxsbs1) "总客数",
 sum(splxssr)+sum(splqtsr) "总计销售收入", 
 round(sum(splxssr )/sum(splxsbs1),2) "总计客单价" 
 from saleposlist where   spldate  between to_date('2006-12-05','yyyy-mm-dd') and to_date('2006-12-06','yyyy-mm-dd') group by spldate having sum(splxsbs1)<>0 );
query1.open;
在delphi中执行上面一段代码,能够正常执行;如果把query1换成adoquery1,并且adoconnect1、datasource1配置正确。运行时提示“ora-00917:not a group by exepression”,不知什么原因,感觉上 sql语句没有错啊,请各位高手帮忙,谢谢!!!

解决方案 »

  1.   

    跟踪变量,查看运行时Adoqury.sql.text的值是否正确
      

  2.   

    SQL语句语法的问题,仔细检查一下
      

  3.   

    把sql 语句放到查询分析器里去调试, sql语句的问题。
      

  4.   

    如楼上大多数人一样根本办法就是输出 CommandText 拿来看,拿到分析器里执行当然不排除某些 数据库 如Access like '%abc' 在 Delphi里可以,到了分析器要用 like '*abc'的情况
      

  5.   

    ORA-00917是错误的符号,是不是你的sql中有符号的错误