I can't figure out why I get an SQL error with the mySQL statement (in php file) below. I think the problem relates to the second condition 'AGREEDPRODUCTS.productid_corporation is null'. I checked that the syntax of the used parameters is correct as used in the database. I also tried other alternatives with respect to the second condition (like using WHERE but that is obvious not allowed;MySQL join with where clause) but those didn't work.
$sqlquery4 = "SELECT AGREEDPRODUCTS.id,AGREEDPRODUCTS.productid_supplier,EMETERPRODUCTS.productname "
. "FROM AGREEDPRODUCTS "
. "INNER JOIN EMETERPRODUCTS "
. "ON AGREEDPRODUCTS.productid_supplier=EMETERPRODUCTS.productid AGREEDPRODUCTS.producttype='EMETER' AND AGREEDPRODUCTS.productid_corporation is null "
. "ORDER BY AGREEDPRODUCTS.productid_supplier";
Any suggestions?