Showing entries 1 to 1
Displaying posts with tag: concatenate (reset)
MySQL - Can You Concatenate Strings From a Column Into a Single Row?

How would one concatenate strings from a column (multiple rows) into a single row using MySQL? I see its possible with MS SQL Server 2005 and above. Any incite into how to achieve this in MySQL would be much appreciated.

MS SQL Server 2005 - Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SELECT Web_Account_ID,
GroupNameConcat = REPLACE(
        (
        SELECT
                Web_Account_Group_Name_ID AS [DATA()]
        FROM
                tblWebAccountGroup WAG
        WHERE
                WAG.Web_Account_ID = WA.Web_Account_ID
        ORDER BY
                Web_Account_Group_Name_ID
            FOR XML PATH ('')
        ), ' ', ',')
FROM tblWebAccounts WA
ORDER BY Web_Account_ID

Query Results Example

Source: …

[Read more]
Showing entries 1 to 1