准备将程序移植到FB1.5,这条SQL语句:
select a,sum(b) as sumb,sum(c) as sumc from table1
group by a order by aindex在IB7中运行正常,但在FB1.5中,去掉'order by aindex'则不再报错。aindex是a的排序字段实际是:
--------------------------------
aindex              a
--------------------------------
 1                 中国
 2                 美国
 3                 日本
--------------------------------
以上是按照aindex 来排序,如果按a 字段来排序,则:美国->日本->中国,不符合系统要求。
排序字段非得在select语句中提及吗?请教该如何解决,急啊!!

解决方案 »

  1.   

    这样看看行不行:
    select a,sum(b) as sumb,sum(c) as sumc from table1
    group by a,aindex order by aindex
      

  2.   

    select a,sum(b) as sumb,sum(c) as sumc from table1
    group by a,aindex order by aindex
    这样就行了
    aindex not contained in either an aggregate function or the GROUP BY clause.
      

  3.   

    好象 FB 不支持 Group By 吧