php - MySQL: Limiting LEFT OUTER JOIN / Left outer join where id = #
one text
Solution:
Add the related clause with AND operator in ON clause
SELECT `custom_fields`.*, `custom_field_filter`.`fieldid` as `selected`
FROM `custom_fields`
LEFT OUTER JOIN `custom_field_filter`
ON `custom_fields`.`ID` = `custom_field_filter`.`fieldid`
AND `custom_field_filter`.`formid` = 6
ORDER BY `custom_fields`.`ID` ASC
the where clause on the left joined table work as an inner join .. instead the use of a condition on the ON clause preserve the left join
Source