Select  T1.count(*),T1.sum(decode(errorcode,0,1,0)) from glc_location_msg_200909 T1 where 1=1 And
left join( 
select tvcityid,servicecode from glc_location_msg_200909  T2 where 1=1  group by tvcityid,servicecode 
) on T1.tvcityid = T2.tvcityid and T1.servicecode=T2.servicecode 
上面sql执行中,T1.count(*)这里报ORA-00936 错误,请问如何修改?

解决方案 »

  1.   


    Select  T1.count(tvcityid,servicecode),T1.sum(decode(errorcode,0,1,0)) from glc_location_msg_200909 T1 
    left join( 
    select t2.tvcityid,t2.servicecode from glc_location_msg_200909  T2   group by tvcityid,servicecode 
    ) on T1.tvcityid = T2.tvcityid and T1.servicecode=T2.servicecode  这个执行时,报 T2.servicecode ,无效的标识符 ,请教如何修改?谢谢了。。
      

  2.   


    Select  count(T1.*),count(A.servicecode),T1.sum(decode(errorcode,0,1,0)) from glc_location_msg_200909 T1 
    left join( 
    select t2.tvcityid,t2.servicecode from glc_location_msg_200909  T2  group by tvcityid,servicecode 
    ) A on T1.tvcityid = A.tvcityid and T1.servicecode=A.servicecode  
      

  3.   

    Select  count(T1.tvcityid),sum(decode(T1.errorcode,0,1,0)) from 
    glc_location_msg_200909 T1 
    left join( 
    select t2.tvcityid,t2.servicecode from glc_location_msg_200909  T2  group by tvcityid,servicecode 
    ) A on T1.tvcityid = A.tvcityid and T1.servicecode=A.servicecode  因为表两一个,所以用count(*)就会提示ORA-01747 ,因为字段一样要指定那个表的字段才行!
      

  4.   

     说实话 这条语句看的我很迷糊。count(t1.*)到底用意何在??