Reputation: 61
In Mysql procedure:
select distinct org_fk from user where id
in(IdList);
idList="1,2,3"
It is only working for first value.
Upvotes: 5
Views: 34
Reputation: 520918
You can't use the IN
operator to compare against a CSV string, only a CSV list of separate values.
But MySQL has a function FIND_IN_SET
which might help here:
SELECT DISTINCT org_fk
FROM user
WHERE FIND_IN_SET(id, idList) > 0;
You may read more about FIND_IN_SET
here.
Upvotes: 4