我想获取[interaction]表的ID,但这些ID不能等于[EmailOUT]表.我无法编写查询.
Select ID from EmailOut where ID NOT IN (select ID from [172.28.101.120].[GenesysIS].dbo.interactions where media_type = 'email' and type = 'Outbound')
类似的东西.我想在交互表中输出外发电子邮件,但这些电子邮件可能存在于EmailOut表中.我想删除它们.出站电子邮件数约为300,但此查询结果应小于300
解决方法
如果你想获得[interaction]表的ID,你似乎应该反转你的查询:
select ID from [172.28.101.120].[GenesysIS].dbo.interactions where media_type = 'email' and type = 'Outbound' AND ID NOT IN (SELECT ID FROM EmailOut)