select
  district,
  d1,
  its,
  max(its) as maxits
from 
  table
group by
 dl,its
where
  d1<to_date('2004-11-5','yy_mm_dd')
and
  d1>to_date('2004-10-5','yy_mm_dd')

解决方案 »

  1.   

    select  district,d1,its,max(its) as maxits
    from table
    where
      d1<to_date('2004-11-5','yy_mm_dd')
    and
      d1>to_date('2004-10-5','yy_mm_dd')
    group by district,d1,its;
      

  2.   

    select  district,d1,max(its) as maxits
    from table
    where
      d1<to_date('2004-11-5','yy-mm-dd')
    and
      d1>to_date('2004-10-5','yy-mm-dd')
    group by district,d1;
      

  3.   

    select  district,d1,its,max(its) as maxits from table
    where
      d1<to_date('2004-11-5','yy_mm_dd')
    and
      d1>to_date('2004-10-5','yy_mm_dd')
    group by district,d1,its;
      

  4.   

    max(its) as maxits 不能用于group by
      

  5.   

    support,group by 放到后面
      

  6.   

    总算找出问题了1、将 group by 放在最后;
    2、group by 后面的列名要包括前面 select 中的所有列。多谢各位的解答