I have a basic schema that is something like below
OrderTable
Id int
1
2
OrderDetailTable
Id int - OrderId int
1 1
2 1
3 1
4 1
5 2
6 2
7 2
I want to get a table that is
OrderOrderDetailCombinationTable
Order int - OrderDetails varchar(100)
Example
Order - OrderDetails
1 1,2,3,4
2 5,6,7
http://www.sqlfiddle.com/#!3/c617b/2
I can get this result by using cursor but cursor has a performance penalty as I know so what can be the better way to get this result ?