Hello everyone,
I will present the simplest problem I can think of for a bigger problem I have.
I have three tables:
tbl_items:
[table]
[tr]
[td]id[/td]
[td]item_name[/td]
[td]item_size[/td]
[/tr]
[tr]
[td]1[/td]
[td]iPad1[/td]
[td]7"[/td]
[/tr]
[tr]
[td]2[/td]
[td]iPad3[/td]
[td]7"[/td]
[/tr]
[tr]
[td]3[/td]
[td]GalaxyTab[/td]
[td]7"[/td]
[/tr]
[/table]
tbl_brands:
[table]
[tr]
[td]id[/td]
[td]brand_name[/td]
[/tr]
[tr]
[td]1[/td]
[td]Apple[/td]
[/tr]
[tr]
[td]2[/td]
[td]Samsung[/td]
[/tr]
[/table]
tbl_item_brands_assignment:
[table]
[tr]
[td]id[/td]
[td]item_id[/td]
[td]brand_id[/td]
[/tr]
[tr]
[td]1[/td]
[td]1[/td]
[td]1[/td]
[/tr]
[tr]
[td]2[/td]
[td]2[/td]
[td]1[/td]
[/tr]
[tr]
[td]3[/td]
[td]3[/td]
[td]2[/td]
[/tr]
[/table]
I want to select data and print it in the following way:
[table]
[tr]
[td]#[/td]
[td]Item Name[/td]
[td]Item Brand[/td]
[/tr]
[tr]
[td]1[/td]
[td]iPad1,iPad3[/td]
[td]Apple[/td]
[/tr]
[tr]
[td]1[/td]
[td]GalaxyTab[/td]
[td]Samsung[/td]
[/tr]
[/table]
Basically, for all duplicates I want them printed separated by commas (,) instead of having many rows.
Thanks!