Question : Grouping rows to one line

ALA MOANA CLINIC      All      All                          NULL                     10.92
ALA MOANA CLINIC      All      All                          10.38                      NULL
ALA MOANA CLINIC      BHS ALM      TREATMENT INDIVIDUAL      NULL                       30.1
ALA MOANA CLINIC      BHS ALM      TREATMENT INDIVIDUAL      15                       NULL

I need the above rows to look like the following
ALA MOANA CLINIC      All      All                         10.38                     10.92
ALA MOANA CLINIC      BHS ALM      TREATMENT INDIVIDUAL    15                       30.1

Answer : Grouping rows to one line

is this something you want?


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
create table TestTable(
column1 varchar(max),
column2 varchar(max),
column3 varchar(max),
column4 varchar(max),
column5 varchar(max),
column6 varchar(max)
)
GO


insert into TestTable
select 'ALA MOANA CLINIC','All','All',NULL,'10.92',null  union all
select 'ALA MOANA CLINIC','All','All','10.38',NULL,null  union all
select 'ALA MOANA CLINIC','BHS','ALM','TREATMENT INDIVIDUAL',NULL,'30.1' union all
select 'ALA MOANA CLINIC','BHS','ALM','TREATMENT INDIVIDUAL','15',NULL
GO

select column1,column2,column3,MAX(column4),MAX(column5),MAX(column6)
from TestTable group by column1,column2,column3
go
Random Solutions  
 
programming4us programming4us