Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Coalescing Multiple Rows Into 1 Row

Author  Topic 

bcgoh
Starting Member

1 Post

Posted - 2008-07-18 : 05:05:56
Hi,
I'm new to SQL Server with a perplexing (to me, a non-technical person) request to address urgently.

CER table has multiple records for each primary id, CERNO. This is to be coalesced into 1 row per CERNO. The no of records per CERNO is not fixed and is expected to range from anywhere between 1 to 50 as a guide. Anyone has any idea how this can be done?

Scenario
CER Table
CERNO State Date
1 1 12/7/08
1 2 12/7/08
1 3 14/7/08
1 1 15/7/08
1 2 16/7/08
2 1 17/7/08
2 2 18/7/08
2 3 19/7/08
3 1 18/7/08


This is to be formatted into CER View
CERNO State Date State Date State Date State Date State Date
1 1 12/7/08 2 12/7/08 3 14/7/08 1 15/7/08 2 16/7/08
2 1 17/7/08 2 18/7/08 3 19/7/08
3 1 18/7/08

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-18 : 05:36:15
http://www.projectdmx.com/tsql/rowconcatenate.aspx
Go to Top of Page
   

- Advertisement -