Most likely to be done in presentation layer
Is this?declare @t table(id int identity(1,1),cnt varchar(100), claimid varchar(100))insert into @t(cnt,claimid)select '','345' union allselect '','SUM' union allselect '# of claims','' union allselect '','7345' union allselect '','6834' union allselect '','SUM' union allselect '# of claims','' select * from @tselect t1.id,case when t1.cnt='' then coalesce(t2.cnt,'') else '' end,t1.claimid from @t as t1 left join( select t1.id,t2.cnt as cnt from @t as t1 inner join ( select * from @t where cnt like '#%' ) as t2 on t1.id+1=t2.id where t1.claimid like 'sum%' ) as t2on t1.id=t2.id
MadhivananFailing to plan is Planning to fail