和/如果条件在加入后不起作用

时间:2013-03-22 22:05:07

标签: mysql

无法弄清楚如何在最后一次内连接后添加条件。最后一个条件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

1 个答案:

答案 0 :(得分: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