这个 oracle 查询有什么问题?
SELECT *
FROM (SELECT ROWNUM rnum,
query.*
FROM (WITH myQuery AS(
SELECT column_b
FROM table_a a
WHERE a.column_a = 1234)
SELECT b.column_e AS some_column
FROM table_b b,
table_c c,
table_a a
LEFT JOIN table_d d ON c.column_c = d.column_d
JOIN myQuery mq ON a.column_b = mq.column_b
WHERE b.column_b = a.column_b) query)
WHERE rnum > 0
SELECT *
FROM (SELECT ROWNUM rnum,
query.*
FROM (WITH myQuery AS(
SELECT column_b
FROM table_a a
WHERE a.column_a = 1234)
SELECT b.column_e AS some_column
FROM table_b b,
table_c c,
table_a a
LEFT JOIN table_d d ON c.column_c = d.column_d
JOIN myQuery mq ON a.column_b = mq.column_b
WHERE b.column_b = a.column_b) query)
WHERE rnum > 0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要混合 ANSI-88 和 ANSI-92 JOIN 语法,选择其中之一。这是使用 ANSI-92 语法的查询:
您的示例缺少 TABLE_C 连接的内容 - 因此
?
和??
我不知道
WITH 子句可以在子查询中定义 - 我确信我过去在 10g 中尝试它时遇到了错误。
Don't mix ANSI-88 and ANSI-92 JOIN syntax, pick one or the other. Here's your query using ANSI-92 syntax:
Your example lacks what TABLE_C joins on to - hence the
?
and??
I didn't know that
WITH
clauses can be defined in subqueries - I was sure I'd encountered an error in the past when attempting it in 10g.