Concatenate multiple rows
问题 I'm using Microsoft SQL Server 2005. I think I need a sub-query. I'm looking for one (1) row per customer, with the AvailableAction field be a concatenation of all the Actions for each customer. use tempdb GO IF DB_ID('myDatabase') IS NOT NULL DROP DATABASE myDatabase go CREATE DATABASE myDatabase GO USE myDatabase GO create table Cust( CustID Int Identity Primary Key, CustName Varchar(255) ) GO INSERT INTO Cust(CustName) values('One') INSERT INTO Cust(CustName) values('Two') GO CREATE TABLE