Click here to Skip to main content
16,009,847 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to concatenate rows in a single row basing on the id,
i used group_concat(ID separator ',')

but not getting..
if u know help me.

Thanks & Regards..
Honey..
Posted

SQL
If you have the table called "table1" with following data,

fID field1
1   Data1
2   Data2
3   Data3

and you want data in one row like: 
Data1, Data2, Data3

then you can use the following query:

select fID, group_concat(field1 separator ', ')  from table1 group by fID;
 
Share this answer
 
Go there[^] to take a reference about CONCAT Function in Mysql.
 
Share this answer
 
i have solved this problem using GroupConcat function,
thanks to all who helped me..
GROUP_CONCAT(Role_Name SEPARATOR ',') as RoleName
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900