这段代码有什么问题?我不断收到 ERROR 1064 (42000): 你的 SQL 语法有错误
SELECT clientReport.id
WHERE clientReport.rowNumber NOT EXISTS (
SELECT clientReport.rowNumber FROM report02, clientReport
WHERE report02.id=clientReport.id);
最佳答案
我假设你想做这样的事情:
SELECT clientReport.id
FROM clientReport
LEFT JOIN report02 ON(report02.id = clientReport.id)
WHERE report02.id is null;
这将从 clientReport 返回所有在 report02 中没有相应条目的 ID。
替代方案可能是:
SELECT clientReport.id FROM clientReport
WHERE clientReport.rowNumber NOT IN (
SELECT clientReport.rowNumber
FROM report02, clientReport
WHERE report02.id=clientReport.id);
关于不存在的 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5962748/