Possible Duplicate:
Concatenate many rows into a single text string?
How to use GROUP BY to concatenate strings in SQL Server?
I have a table customer (id, person_id, account number), id is primary key. For example
id person_id account number
1 0001 acc00011
2 0001 acc00012
3 0002 acc00021
Now I want to write a query to self join the table to get all the account numbers for each person. The result table should be
person_id account
0001 acc00011, acc00012
0002 acc00021
How do I write the query?