hi friends,
just wondering if some one can help me writing this query?
drop table #temp
create table #temp (branch varchar(20), branch_no varchar(5), client varchar(100))
insert into #temp
select 'LA', '21200', '11212132'
union
select 'LA', '21200', '11213434'
union
select 'LA', '21200', '11213444'
union
select 'MA', '21201', '23233333+'
union
select 'MA', '21201', '11212132red'
union
select 'MA', '21201', '11212132green'
union
select 'MA', '21201', '11213132green'
select * from #temp
I want to group the branch and put client in one row.
branch branch no client 1 client 2 client 3 client 4
LA 21200 11212132 11213434 11213444
MA 21201 11212132green 11212132red 11213132green 23233333+
i dont know how many clients would be there in one branch. also the pivot needs sum and i cant use the sum here.
thanks.