I have a table like this:
ID | C1 | C2 | seq |
---|---|---|---|
1 | This is my re | ally long sentence | 1 |
1 | This is my re | stored in a | 2 |
1 | This is my re | really terrible format | 3 |
And I need some SQL query or stored procedure to pull it out such that it reads "this is my really long sentence stored in a really terrible format"
select
case
when seq = '1'
then c1 else ''
end + stuff((select c2 from table t2
where t2. id = t1.id and t2.seq = t1.seq
for xml path('')), 1, 1, '')
from
table t1
I've got this going but it's putting XML in and I can't figure out why. Any help is appreciated.