sql - Concatenating records in a single column without looping? -
I have a table with 1 column of sarika values I add those values without adding a value to it with a loop I see the way, if possible. If a loop is the most efficient way to go about it, then I go in that way, but it came to understand that I ask for other options before I miss it. I would like to put it inside a SQL query.
Eventually, I want to contrast a different function.
Is it possible to do without a loop? Or cursor) or should I just use a loop to do this?
Edit: Since there was a very good answer with how to do this in MySQL (as opposed to MS SQL I did initially) I decided to comment, so that others could get the answer too. .
Announce @concat varchar (max) set @concat = ''
Choose @concat = @concat + col1 + ',' from tablename1
Comments
Post a Comment