1

我有一个邮件收件人表,通过 many2many 表(recipients_mails)链接到邮件消息表。每次发送邮件时,我都会在 many2many 表中添加一行。

我需要知道哪些收件人没有收到 ID 为 n 的电子邮件。3.

桌子是这样雕刻的:

Recipients
recipient_id, email

Recipients_mails
recipient_fk, mail_fk

Mails
mail_id, content etc.

非常感谢

4

1 回答 1

1
SELECT  *
FROM    recipients
WHERE   NOT EXISTS
        (
        SELECT  NULL
        FROM    recipients_mails
        WHERE   (recipient_fk, mail_fk) = (recipient_id, 3)
        )
于 2013-01-15T20:54:18.747 回答