concatenation - Concatenate two columns based upon another column in SQL Server 2005 -
i have database follows
a b 1 ereee 2 ereee 2 sdfsd 3 nere 1 sdfsd
i want have data follows
a b 1 ereee,sdfsd 2 ereee,sdfsd 3 nere
what query?
your question didn't specify kind of database. following works mysql , perhaps few others:
group_concat(expr)
function returns string result concatenated non-null values group.
https://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat
select a, group_concat(b separator ',') b table group
update 2015-07-30 09:43 +0000
since it's been made clear sql server 2005, question might duplicate of this:
simulating group_concat mysql function in microsoft sql server 2005?
Comments
Post a Comment