I have some groups. Each group has some elements, each element has an ID and a NAME.
GROUPS
|___________|_______________|
|GROUP_NAME |ELEMENT_IDS |
|___________|_______________|
|ala |15,16,18 |
|bala |18,15 |
|coala |16 |
ELEMENTS
|___________|_______________|
|ID |NAME |
|___________|_______________|
|15 |foo |
|16 |bar |
|18 |car |
What kind of join (in MySQL) I should do in order to output the following:
|___________|_______________|_________________________________|
|GROUP_NAME |ELEMENT_IDS |ELEMENT_NAMES |
|___________|_______________|_________________________________|
|ala |15,16,18 |foo,bar,car |
|bala |18,15 |car,foo |
|coala |16 |bar |