0

我使用 not in 和 in 提出了以下查询。我需要将其转换为使用不存在的查询。

SELECT T_DATE, T_DEPTIME
FROM TOUR
WHERE T_ID NOT IN (
SELECT T_ID 
FROM RESERVATION 
WHERE R_ID IN (
SELECT R_ID 
FROM PRES
WHERE P_ID IN (
SELECT P_ID
FROM PARTICIPANT
WHERE P_STATE = 'FL')));

有人能帮我吗?

谢谢

4

1 回答 1

0

尝试这个。

SELECT d.t_date, d.t_deptime
  FROM tour d
 WHERE NOT EXISTS (
          SELECT 1
            FROM reservation a, pres b, participant c
           WHERE c.p_state = 'FL'
             AND b.p_id = c.p_id
             AND a.r_id = b.r_id
             AND a.t_id = d.t_id);
于 2013-05-20T10:17:31.310 回答