有人可以向我解释为什么下面的查询没有返回所有匹配的记录
creator_id = 10895
然后是与
链接的所有记录 组表中的 staff_id = 10895
?
它只返回匹配staff_id = 10895
SELECT
direct_message.*,
IFNULL(direct_message_group.staff_id, 0) as staff_id
FROM `direct_message`
INNER JOIN direct_message_group
ON direct_message_group.chat_id = direct_message.id
INNER JOIN direct_message_thread
ON direct_message_thread.chat_id = direct_message.id
WHERE
(
direct_message.recipient_id = '10895' OR
direct_message.creator_id = '10895'
OR (
direct_message_group.staff_id = '10895'
AND direct_message_group.active = '0')
)
AND direct_message.school_id = '1'
AND direct_message_thread.school_id = direct_message.school_id
GROUP BY direct_message.id
ORDER BY direct_message_thread.inserted DESC
LIMIT 0, 25
表格图片