sql 语句:
SELECT
(
SELECT
Group_concat(t_work_group_user.user_id)
FROM
t_work_group_user
WHERE
t_work_group_user.work_group_id = workGroup.id
) AS userids,
(
SELECT
Group_concat(t_user.username)
FROM
t_work_group_user
INNER JOIN t_user ON t_user.id = t_work_group_user.user_id
WHERE
t_work_group_user.work_group_id = workGroup.id
) AS usernames,
workGroup.id,
workGroup. NAME,
workGroup.corp_id AS corpId,
workGroup.state,
workGroup.create_time AS createTime
FROM
t_work_group AS workGroup
WHERE
workGroup.state != '0'
结果:
作者:逆舟
https://www.cnblogs.com/zy-jiayou/
本博客文章均为作者原创,转载请注明作者和原文链接。
https://www.cnblogs.com/zy-jiayou/
本博客文章均为作者原创,转载请注明作者和原文链接。