i’ve this two tables:
Table 1
Key, CenterId, Value
01 Center A 10
02 Center B 100
03 Center C 50
and
Table 2
Center, SubCenter, A-Field, B-Field Center A Sub 1 ... ... Center A Sub 2 Center A Sub 3 ... ...
I need to get ONE ROW per Center (one row from Table 1) and, all the subcenters but without duplicating row … so my last result must be:
Query Result
Center, Value, List-of-SubCenter Center A, 10, Sub1 Sub2 Sub 3 Center B, 100, Sub4 ... Sub N
How to do this in Sql (in particular SQL-SERVER) ?
Thank you
This should work for SQL Server 2005 and upwards