I have a table1 as
id value1 Xmlvalue
1 abc <value value1=abc id = 1>
2 abcd <value value1=abcd id = 2>
3 defg <value value1=defg id = 3>
4 def <value value1=def id = 4>
5 ghi <value value1=ghi id = 5>
and table2 as
id value1 Xmlvalue
1,2 abc
3,4 def
5 ghi
I need output table as
id value1 Xmlvalue
1,2 abc <root><value value1=abc id = 1><value value1=abcd id = 2></root>
3,4 def <root><value value1=defg id = 3><value value1=def id = 4></root>
5 ghi <root><value value1=ghi id = 5></root>
Note: My XmlValue columns are of type varchar(max). I have used these columns in other queries in same store procedure and if I make these columns of type XML then it gives me error in group by.