1

任何人都可以提供帮助,因为我看不到此错误消息的来源:

每个派生表都必须有自己的别名

在我看来,我已经为所有表添加了别名?

SELECT ccdnormal.*
FROM card_call_detail AS ccdnormal
JOIN (

    SELECT ccd1.DB_CALL_ID
    FROM card_call_detail_tmp1 AS ccd1
    JOIN card_call_detail_tmp2 AS ccd2 ON ccd1.card_number = ccd2.card_number
    WHERE ccd1.start_time <> ccd2.start_time
      AND ccd1.end_time > ccd2.start_time
      AND ccd1.DB_CALL_ID <> ccd2.DB_CALL_ID
      AND ccd2.start_time BETWEEN ccd1.start_time AND ccd1.end_time

    UNION ALL

    SELECT ccd4.DB_CALL_ID
    FROM card_call_detail_tmp3 AS ccd3
    JOIN card_call_detail_tmp4 AS ccd4 ON ccd3.card_number = ccd4.card_number
    WHERE ccd3.start_time <> ccd4.start_time
      AND ccd3.end_time > ccd4.start_time
      AND ccd3.DB_CALL_ID <> ccd4.DB_CALL_ID
      AND ccd4.start_time BETWEEN ccd3.start_time AND ccd3.end_time )

) AS CCDOUTPUT ON CCDOUTPUT.DB_CALL_ID = ccdnormal.DB_CALL_ID
4

0 回答 0