select * from
(
select id, a.meeting_id as meeting_id, GROUP_CONCAT(b.user_id) as user_ids
from m as a left join u as b
group by a.meeting_id
) a
where FIND_IN_SET(#{userId}, a.user_ids)
其中GROUP_CONCAT 可以把分组的数据聚合在一起
FIND_IN_SET 可以查询字段是否包含某个值
select * from
(
select id, a.meeting_id as meeting_id, GROUP_CONCAT(b.user_id) as user_ids
from m as a left join u as b
group by a.meeting_id
) a
where FIND_IN_SET(#{userId}, a.user_ids)
其中GROUP_CONCAT 可以把分组的数据聚合在一起
FIND_IN_SET 可以查询字段是否包含某个值