我需要在MS Access中执行sql查询。
但是我在MS Access中遇到错误:
SELECT *
FROM
(
SELECT *
FROM table1
where not exists
(
SELECT *
FROM table2
where table2.id = table1.id
) as t
) as t1, table3
where table3.id = t1.id
语法错误:查询表达式't中不存在(...)为(运算符)'
任何帮助,将不胜感激。
不存在子选择不需要别名。请注意,我已经删除了as t
SELECT *
FROM
(
SELECT *
FROM table1
where not exists
(
SELECT *
FROM table2
where table2.id = table1.id
)
) as t1, table3
where table3.id = t1.id
您也可以考虑使用inner join
和left join
来摆脱您的问题not exists
:
这应该与上述内容完全相同:
SELECT t1.*, t3.*
FROM
table1 t1
inner join table3 t3 on t1.id = t3.id
left join table2 t2 on t1.id = t2.id
where
t2.id is null
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句