mysql WHERE不使用LEFT JOIN

时间:2017-05-22 00:45:09

标签: mysql join where dreamweaver

由于一些帮助,我得到LEFT JOIN工作,但需要它根据记录是否有效显示所选结果。这些在记录中标记为Y或N.

代码是

SELECT suppliers.ID, suppliers.Suppliername, suppliers.postcode, suppliers.address, 
    suppliers.phone, suppliers.fax, suppliers.email, suppliers.website, suppliers.imagename, 
    suppliers.Active, suppliers.RepID, repdetails.RepID, 
    repdetails.RepName, repdetails.RepEmail, repdetails.RepPhone 
FROM suppliers LEFT JOIN repdetails 
    ON suppliers.RepID = repdetails.RepID 
ORDER BY Suppliername ASC

以前使用URL工作?Active = Y或?Active = N但是我无法理解如何让它再次工作。

任何帮助都会受到赞赏,因为我是新手:)

1 个答案:

答案 0 :(得分:0)

SELECT suppliers.ID, suppliers.Suppliername, suppliers.postcode, suppliers.address, 
    suppliers.phone, suppliers.fax, suppliers.email, suppliers.website, suppliers.imagename, 
    suppliers.Active, suppliers.RepID, repdetails.RepID, 
    repdetails.RepName, repdetails.RepEmail, repdetails.RepPhone 
FROM suppliers LEFT JOIN repdetails 
    ON suppliers.RepID = repdetails.RepID 
WHERE suppliers.Active = "y" ORDER BY suppliers.Suppliername ASC

试试这个