mysql not in 和 not exits
时间:2021-07-01 10:21:17
帮助过:3人阅读
exists 版本
SELECT
org.*,
u.rname AS uname
FROM
exam_org org
LEFT JOIN exam_user u
ON org.ouid
= u.uno
WHERE NOT EXISTS
(SELECT
id
FROM
exam_org
WHERE id
IN (
8,
0)
AND id
= org.id)
not in
SELECT
org.*,
u.rname AS uname
FROM
exam_org org
LEFT JOIN exam_user u
ON org.ouid
= u.uno
WHERE id
not in(
8,
0)
由此可见,对于没有子查询来说 ,not in 和
not exists 应该是差不多的
mysql not in 和 not exits
标签:from style log not 版本 sts select 子查询 class