很抱歉再次发布有关此主题的信息。这有 4 页的结果,很难确定具体的解决方案。
任何人都可以看到这个 SQL 有什么问题吗?
SELECT evntmst_id, count(evntmst_id) AS idcount
FROM evntcond
WHERE EVNTMST_ID NOT IN (
SELECT DISTINCT c.EVNTMST_ID
FROM evntcond c
LEFT JOIN evntmst m
ON c.EVNTMST_ID = m.EVNTMST_ID
WHERE m.EVNTMST_TYPE IN (1, 7) -- Group or Subset
AND m.EVNTMST_ID IS NOT NULL -- remove data integrity issues
GROUP BY c.EVNTMST_ID
ORDER BY c.EVNTMST_ID
)
GROUP BY EVNTMST_ID
ORDER BY count(evntmst_id) Desc
这产生
ORA-00907: missing right parenthesis
如果我采用嵌套的 SELECT DISTINCT 并将其替换为 1,2,则一切正常。
SELECT evntmst_id, count(evntmst_id) AS idcount
FROM evntcond
WHERE EVNTMST_ID NOT IN (
1,2
)
GROUP BY EVNTMST_ID
ORDER BY count(evntmst_id) Desc
如果我自己运行嵌套查询,一切正常。
SELECT DISTINCT c.EVNTMST_ID
FROM evntcond c
LEFT JOIN evntmst m
ON c.EVNTMST_ID = m.EVNTMST_ID
WHERE m.EVNTMST_TYPE IN (1, 7) -- Group or Subset
AND m.EVNTMST_ID IS NOT NULL -- remove data integrity issues
GROUP BY c.EVNTMST_ID
ORDER BY c.EVNTMST_ID
甲骨文怎么了。这是一个错误吗?