Let’s say I’ve got typical many-to-many relationship with three tables.
---------
--boxes--
---------
id name
---------
1 Green Box
2 Red Box
3 Yellow Box
----------
--fruits--
----------
id name
----------
id name
1 apple
2 orange
--------------
--fruitboxes--
--------------
boxID fruitID
--------------
1 1
1 2
2 1
2 2
3 1
I want to create a view that would result in
--------------------------
--------boxes view--------
--------------------------
id name fruits
--------------------------
1 Green Box apple,orange
2 Red Box apple,orange
3 Yellow Box apple
I’m using a ms SQL. Any ideas how to do this?
thanks
Test it here: https://data.stackexchange.com/stackoverflow/q/101351/concatenate-strings
Fruit ID’s instead of name