I have database as follows
A B
1 ereee
2 ereee
2 sdfsd
3 nere
1 sdfsd
I want to have a data which will be as follows
A B
1 ereee,sdfsd
2 ereee,sdfsd
3 nere
what is the query?
I have database as follows
A B
1 ereee
2 ereee
2 sdfsd
3 nere
1 sdfsd
I want to have a data which will be as follows
A B
1 ereee,sdfsd
2 ereee,sdfsd
3 nere
what is the query?
Your question didn't specify what kind of database. The following works for MySQL and perhaps a few others:
GROUP_CONCAT(expr)
This function returns a string result with the concatenated non-NULL values from a group.
https://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat
SELECT A, GROUP_CONCAT(B SEPARATOR ',') AS B
FROM table
GROUP BY A
Since it's been made clear that this is about SQL Server 2005, the question might be a duplicate of this:
Simulating group_concat MySQL function in Microsoft SQL Server 2005?