Nigel Peck wrote:
Sorry, make that:
SELECT `Raw_materials`.`raw_mat_id`, `Raw_materials`.`name`
FROM
`Raw_materials`
LEFT JOIN
`Raw_materials__Products`
ON
`Raw_materials`.`raw_mat_id` =
`Raw_materials__Products`.`raw_mat_id`
WHERE
`Raw_materials__Products`.`raw_mat_id` IS NULL AND
`Raw_materials__Products`.`product_id` = '1'
I got it, I needed to move checking the product_id to the ON clause:
SELECT `Raw_materials`.`raw_mat_id`, `Raw_materials`.`name`
FROM
`Raw_materials`
LEFT JOIN
`Raw_materials__Products`
ON
`Raw_materials`.`raw_mat_id` = `Raw_materials__Products`.`raw_mat_id`
AND
`Raw_materials__Products`.`product_id` = '1'
WHERE
`Raw_materials__Products`.`raw_mat_id` IS NULL
Cheers,
Nigel
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]