For any person using @variable in concat_ws function to get concatenated values, don't forget to reinitialize it with empty value. Otherwise it can use old value for same session.
Set @Ids = '';
select
@Ids := concat_ws(',',@Ids,tbl.Id),
tbl.Col1,
...
from mytable tbl;