Log in

View Full Version : stored procedure using while loop.



bojohere
05-06-2011, 10:04 AM
Hi experts hope every one is doing well.

please help me write stored procedure
I have 2 columns
num name
1 john
1 jessy
1 Glen
2 Jennifer
2 Michael
3 Paul
3 Mike

the output I require should be in the format:
tabel name: abc

num Name
1 john,jessy,Glen
2 Jennifer, Michael
3 Paul, Mike

I have written a select statement using group_concat operator and it ha given me the exact output which I require.

select num , group_concat(name) from abc group by num;

But I need to write a stored procedure for this which shoud give the same result. Which means I should compare each row with another.

please suggest me how can it be achieved.

bojohere
05-06-2011, 10:05 AM
some one please help me .. as am new to mysql and to this forum as well....