I have a table which has 2 rows
now I would like to merge these rows and get a single string. something like this 'santhosh,santhosh'
I checked some examples suggesting to use COALESCE tried like this
set @col = '';
SELECT @col = COALESCE(@col + ',', '') + name into @col
FROM cricketers limit 20;
select @col;
but I never got the expected results, how should I achieve this, I'm running this inside a procedure. i would like to use the variable @col for doing a query like this
select * from table where id in (@col)
if I'm not following the correct process please suggest something.