0

无法弄清楚如何在最后一次内部连接之后添加条件。最后一个条件 lc.unsubscribed_c <> 1 不起作用..我也试过 AND。不知道如何让它工作。

SELECT 
l.first_name,
l.last_name,
lc.code_c,
lc.unsubscribed_c,
ea.email_address
FROM email_addr_bean_rel eabr
JOIN email_addresses ea
ON eabr.email_address_id = ea.id
AND eabr.deleted = 0
JOIN leads l
ON eabr.bean_id = l.id
AND l.deleted = 0
INNER JOIN
leads_cstm lc ON l.id = lc.id_c
WHERE
lc.unsubscribed_c <> 1
4

1 回答 1

0

尝试:

SELECT 
l.first_name,
l.last_name,
lc.code_c,
lc.unsubscribed_c,
ea.email_address
FROM email_addr_bean_rel eabr
JOIN email_addresses ea ON eabr.email_address_id = ea.id
JOIN leads l ON eabr.bean_id = l.id
INNER JOIN leads_cstm lc ON l.id = lc.id_c
WHERE
lc.unsubscribed_c <> 1
AND eabr.deleted = 0
AND l.deleted = 0
于 2013-03-22T22:13:17.097 回答