mysql WHERE 不使用 LEFT JOIN

mysql WHERE not working with LEFT JOIN

多亏了一些帮助,我已经让 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 来工作,但我不知道如何让它再次工作。

任何帮助将不胜感激,因为我是新手:)

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

试试这个