MySQL supports this alternative syntax for Outer Join. However, this does not mean that it should be used.
- It may be problematic to have RDBMS-specific code if at some point you need to switch to another DBMS.
- MySQL does not seem to support this syntax for more than two joins.
Besides:
Another non-ANSI problem with code is subsequent merging.
This is a quick hit on the ANSI compatible version (not tested):
SELECT DISTINCT ra.folder_id, pd.id, f.name, pd.descriptor_text FROM permission_descriptors pd LEFT JOIN permission_descriptor_users pdu ON pdu.descriptor_id = pd.id LEFT JOIN role_allocations ra ON pd.id = ra.permission_descriptor_id LEFT JOIN folders f ON ra.folder_id = f.id WHERE pdu.descriptor_id IS NULL AND pd.id <> 1 ORDER BY ra.folder_id;
Other notes:
For inequality != Will work, but <> is preferred.
source share