I’m working with SQL Server 2008.
Let’s say I have these three tables:
Product
1, "Honda Civic"
2, "Fiat Ritmo"
3, "Ford Fiesta"
ProductGroup
1, 1, 1
2, 1, 2
3, 3, 1
4, 2, 3
5, 2, 4
6, 1, 5
Group
1 American
2 Asian
3 European
4 Old
5 Fast
And let’s say I want to query these tables so as to get the following:
"Fiat Ritmo", "European, Old"
"Honda Civic", "Asian, Fast"
"Ford Focus", "American"
How can I do this?
I’m using paging on the client side so I can’t group the pages there.
Thanks for your help,
Barry
Use FOR XML PATH feature to get string grouping like this: