MYSQL查询 存在一个表而不在另一个表中的数据

  1. select distinct A.ID from A where A.ID not in (select ID from B)
  2. select A.ID from A left join B on A.ID=B.ID where B.ID is null
  3. select * from A where (select count(*) from B where A.ID = B.ID) = 0;

以上是存在A表,但是不存在B表的数据

发表评论

邮箱地址不会被公开。 必填项已用*标注