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 错误,请问如何修改?
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 ,无效的标识符 ,请教如何修改?谢谢了。。
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
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 ,因为字段一样要指定那个表的字段才行!