我已经尽我所能尝试了,但我很难找出这个查询的问题。
当我执行查询时,它会从 table 中带来重复的行deleted_messages
。我正在private_messages
与deleted_messages
. deleted_messages
保留已被用户完全删除的那些消息。
SELECT private_messages.EA_MID
,private_messages.EA_to
,private_messages.EA_from
,private_messages.EA_DateSent
,private_messages.EA_Subject
,private_messages.EA_Message
,private_messages.EA_Opened
,private_messages.EA_RecipientDeleted
,private_messages.EA_SenderDeleted
,deleted_messages.EA_DMID
,deleted_messages.EA_UID
,deleted_messages.EA_MID
,deleted_messages.EA_Date
FROM deleted_messages
LEFT JOIN private_messages ON (deleted_messages.EA_UID = private_messages.EA_to)
OR (deleted_messages.EA_UID = private_messages.EA_from)
WHERE (
(
private_messages.EA_to = '$uid'
AND private_messages.EA_RecipientDeleted = '1'
)
OR (
private_messages.EA_from = '$uid'
AND private_messages.EA_SenderDeleted = '1'
)
)