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