我有这个 MySQL 查询
SELECT perms.permission_id, perms.long_title, perms.category, gperms.value FROM
acl_permissions AS perms JOIN acl_group_permissions AS gperms ON
(perms.permission_id = gperms.permission_id AND gperms.group_id = 1) WHERE
perms.type IN ('adm', 'cs') AND perms.simple_title NOT IN ('adm_', 'cs_')
ORDER BY perms.long_title
基本上导致问题的位在ON
. 我希望查询根据 where 条件返回所有行,perms
而不管是否有行匹配gperms.group_id = 1
。
gperms.value
如果没有行匹配,理想情况下只是一个空字符串gperms.group_id = 1
。