I need to wright function which will take string of ids like
('id1,id2,id3...idN')
and then pass it in Clause
call of this function will look like select ('id1,id2,id3...idN')
inside of function its doing select like this
select * from table where id in (@string)
if i am passing string as string its not working string looks like '8409 , 8410, 8414, 8416, 10284, 8408'
, how to pass it as individual ids , not as string?
If your string is formatted like 8409 , 8410, 8414, 8416, 10284, 8408
,then another choice is using LIKE
:
SELECT * FROM table WHERE CONCAT(',','string of id',',') LIKE CONCAT('%,',id,',%')
FIND_IN_SET() might also helpful to you
SELECT * FROM table WHERE FIND_IN_SET(id,'string of id');