In Mysql procedure:
select distinct org_fk from user where id
in(IdList);
idList="1,2,3"
It is only working for first value.
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.
Stack overflow Link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With