not exists与exists的用法示例
2017-09-20 本文已影响16人
GuangHui
SELECT COUNT(*)
FROM mc_store s
WHERE
NOT Exists(
SELECT 1 FROM mc_payeestore_rel ps WHERE ps.store_id = s.id
);
--not exists 是exists的反面
SELECT COUNT(*)
FROM mc_store s
WHERE
Exists(
SELECT 1 FROM mc_payeestore_rel ps WHERE ps.store_id = s.id
);