创建物化视图使用以下查询语句报ORA-22818:不支持下面方式子查询

村野樵夫 2014-07-24 09:00:27
麻烦给改造以下sql使之创建物化视图是正确的:
select
assetip,
mac,
(select count(distinct t.AGENTID)
from TD_agentpatchrel t, td_agent t1
where t.AGENTID = t1.AGENTID
and t1.state = 1
and t.PATCHSTATUS = 0) unPatchedCount,
(select count(t.id) from td_avsoft t,td_agent t1 where t.agentid=t1.agentid and t1.state =1) avsoftCounts,
(select count(assetcode) from ass_asset_baseinfo) deviceCount,
(select count(os) from td_agentinfo where os='2') xp,
(select count(os) from td_agentinfo where os='5') win7,
(select count(os) from td_agentinfo where os in('1','2','3','4','5','6','7')) wins,
(select count(os) from td_agentinfo where os='0') nowins,
(select count(asset_type) from td_agentinfo where asset_type='999999999999999005') desktopCount,
(select count(asset_type) from td_agentinfo where asset_type='999999999999999006') laptopCount,
(select count(asset_type) from td_agentinfo where asset_type='999999999999999002') serverCount
from td_agentinfo
...全文
314 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
村野樵夫 2014-07-25
  • 打赏
  • 举报
回复
引用 2 楼 xmt1139057136 的回复:
物化视图 select d.name,后面不能是子查询 ,这种写法是不支持的
我知道不支持这种写法,现在想问请教下如何改写现在的sql语句使之支持!
业余草 2014-07-25
  • 打赏
  • 举报
回复
这个需要sql专区的高手,我对sql只知道皮毛
业余草 2014-07-24
  • 打赏
  • 举报
回复
物化视图 select d.name,后面不能是子查询 ,这种写法是不支持的
业余草 2014-07-24
  • 打赏
  • 举报
回复
ORA-22818

81,092

社区成员

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

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