将 Oracle SQL Select 转换为 PostgreSQL select
我有这样的 SQL 语句:
SELECT ABX.ABX_APO_NUMBER,
COUNT(A1.PROCESS_MODE) AS NUM_PLANNING,
COUNT(A2.PROCESS_MODE) AS NUM_SETUP,
COUNT(A3.PROCESS_MODE) AS NUM_OUTPUT
FROM ABX, USER_INSTANCE U, ACTIVE_PROCESS A1,
ACTIVE_PROCESS A2, ACTIVE_PROCESS A3
WHERE U.ABX_APO_NUMBER (+) = ABX.ABX_APO_NUMBER
AND A1.PROCESS_INSTANCE_NUMBER (+) = U.INSTANCE_NUMBER
AND A1.PROCESS_MODE (+)= 'PLANNING'
AND A2.PROCESS_INSTANCE_NUMBER (+) = U.INSTANCE_NUMBER
AND A2.PROCESS_MODE (+) = 'SETUP'
AND A3.PROCESS_INSTANCE_NUMBER (+) = U.INSTANCE_NUMBER
AND A3.PROCESS_MODE (+) = 'OUTPUT'
GROUP BY ABX.ABX_APO_NUMBER
The (+) is Causeing Fits for PG...我可以删除它们吗?它会意味着同样的事情吗? Postgres 能理解的等价物是什么?
I have this SQL statement:
SELECT ABX.ABX_APO_NUMBER,
COUNT(A1.PROCESS_MODE) AS NUM_PLANNING,
COUNT(A2.PROCESS_MODE) AS NUM_SETUP,
COUNT(A3.PROCESS_MODE) AS NUM_OUTPUT
FROM ABX, USER_INSTANCE U, ACTIVE_PROCESS A1,
ACTIVE_PROCESS A2, ACTIVE_PROCESS A3
WHERE U.ABX_APO_NUMBER (+) = ABX.ABX_APO_NUMBER
AND A1.PROCESS_INSTANCE_NUMBER (+) = U.INSTANCE_NUMBER
AND A1.PROCESS_MODE (+)= 'PLANNING'
AND A2.PROCESS_INSTANCE_NUMBER (+) = U.INSTANCE_NUMBER
AND A2.PROCESS_MODE (+) = 'SETUP'
AND A3.PROCESS_INSTANCE_NUMBER (+) = U.INSTANCE_NUMBER
AND A3.PROCESS_MODE (+) = 'OUTPUT'
GROUP BY ABX.ABX_APO_NUMBER
The (+) is causing fits for PG... Can I just remove those and it will mean the same thing? What would be the equivalent that Postgres would understand?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是使用 ANSI-92 JOIN 语法重写的查询:
(+)
是 Oracle 特定的 LEFT OUTER JOIN 语法。要删除它,需要每个USER_INSTANCE.instance_number
必须具有全部三种处理模式的值:PLANNING、SETUP 和 OUTPUT - 省略其中一项,并且 abx_apo_number 将不会显示在输出。Here is your query re-written using ANSI-92 JOIN syntax:
The
(+)
is Oracle specific LEFT OUTER JOIN syntax. To remove it, would require that eachUSER_INSTANCE.instance_number
would have to have values for the process modes being all three: PLANNING, SETUP, and OUTPUT - omit one, and the abx_apo_number would not be displayed in the output.不,你不能直接删除它们!
(+) 是
OUTER JOIN
的旧表示法。例如
必须改为
No, you can not just remove them!
The (+) is the old notation of an
OUTER JOIN
.For example
would have to be changed to