请教关于ORA-00936: 缺少表达式 的问题!

asdsadfe 2009-10-14 08:51:19

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 错误,请问如何修改?
...全文
2757 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ty_tarena_pger 2009-10-15
  • 打赏
  • 举报
回复
SUM
huangdh12 2009-10-14
  • 打赏
  • 举报
回复
说实话 这条语句看的我很迷糊。。。。count(t1.*)到底用意何在??
cosio 2009-10-14
  • 打赏
  • 举报
回复
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 ,因为字段一样要指定那个表的字段才行!
cosio 2009-10-14
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 chinazmg 的回复:]
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 ,无效的标识符 ,请教如何修改?谢谢了。。
[/Quote]

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






asdsadfe 2009-10-14
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 cosio 的回复:]
SQL code改为:count(T1.*)
[/Quote]
试过,还是报错。。ORA-01747
asdsadfe 2009-10-14
  • 打赏
  • 举报
回复

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 ,无效的标识符 ,请教如何修改?谢谢了。。
cosio 2009-10-14
  • 打赏
  • 举报
回复
改为:count(T1.*)

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧