在Code Igniter中从MySQL中检索数据..
目前我的查询是:
SELECT `gs_team_members`.`team_id`,
`gs_users`.*
FROM (`gs_team_members`)
JOIN `gs_users`
ON `gs_users`.`id` = `gs_team_members`.`member_id`
JOIN `gs_user_privileges`
ON `gs_user_privileges`.`user_id` = `gs_users`.`id`
WHERE `gs_users`.`user_type` = 'member'
AND `gs_users`.`id` != '4'
AND `gs_user_privileges`.`privilege_id` = 7
AND FIND_IN_SET('19', submenu_previlege)
AND `gs_team_members`.`team_id` IN ('1', '2')
AND `team_id` = '2'
GROUP BY `gs_users`.`name`
ORDER BY `gs_users`.`name` ASC;
gs_team_members.team_id
= 1时工作正常(仅表示一个数字ID)。我希望它适用于gs_team_members.team_id
= 1,2(表示多个逗号分隔的ID)
答案 0 :(得分:0)
这是一个例子..请尝试这个
SELECT * FROM user
其中FIND_IN_SET(user_id,(' 1,36,37'))