SELECT DISTINCT
(c.group_type),
c.message_id,
`SUBJECT`,
post_date,
tn.id,
b.STATUS
FROM
tc_notice_text tn
LEFT JOIN tc_notice_group c ON tn.id = c.message_id
LEFT JOIN tc_notice_status b ON tn.id = b.message_id
WHERE
c.`group_type` IN ( 1, 5 )
AND c.platform_user_id IN ( 0,2 )
AND tn.post_status IN (1)
AND tn.type = 0
AND tn.`STATUS` = 0
AND tn.mechanism_id = '1189'
AND tn.id IN (
SELECT
temps.message_id
FROM
(
SELECT DISTINCT
(tng.group_type),
tng.message_id
FROM
tc_notice_text tnt
LEFT JOIN tc_notice_group tng ON tnt.id = tng.message_id
WHERE
tng.group_type IN ( 1, 5 )
AND tnt.post_status = 1
AND tnt.type = 0
AND tnt.`STATUS` = 0
AND tnt.id NOT IN (SELECT tns.message_id FROM tc_notice_status tns WHERE tns.rec_id = 1 AND tns.`STATUS` = 1)
) temps
)
执行如下语句报Column cast(tonder_test.tn.id) is ambiguous