SELECT DISTINCT T_CINEMA.CINEMA_ENTITY_ID,T_CINEMA.CINEMA_NAME
FROM T_CINEMA,T_GROUP_CINEMA
WHERE
NOT EXISTS
(
SELECT null FROM T_GROUP_CINEMA
where T_GROUP_CINEMA.CINEMA_ENTITY_ID=T_CINEMA.CINEMA_ENTITY_ID
);
SELECT DISTINCT T_CINEMA.CINEMA_ENTITY_ID,T_CINEMA.CINEMA_NAME
FROM T_CINEMA,T_GROUP_CINEMA
WHERE
T_CINEMA.CINEMA_ENTITY_ID not in(SELECT CINEMA_ENTITY_ID FROM T_GROUP_CINEMA);
当T_GROUP_CINEMA表没数据依然可以查询出数据来
select T_CINEMA.CINEMA_ENTITY_ID,T_CINEMA.CINEMA_NAME
from T_CINEMA
where not exists (select 1 from T_GROUP_CINEMA where T_GROUP_CINEMA.CINEMA_ENTITY_ID=T_CINEMA.CINEMA_ENTITY_ID )