时间:2021-07-01 10:21:17 帮助过:3人阅读
NOT EXISTS
SELECT
a.*
FROM
t_user a
WHERE
a.id_card LIKE ‘%3203821995100%‘
AND NOT EXISTS (
SELECT
id
FROM
tr_user_product_doctor tupd
WHERE
a.id = tupd.user_id
)
NOT IN
SELECT
a.*
FROM
t_user a
WHERE
a.id_card LIKE ‘%3203821995100%‘
AND a.id NOT IN (
SELECT DISTINCT
user_id
FROM
tr_user_product_doctor
)
说明 : 根据id_card查询不在tr_user_product_doctor表中出现的user_id
sql语句学习(NOT EXISTS 和 NOT IN )
标签:log upd _id rom exist car rod use from