i have query that has subselect that may return more than 1 result:
SELECT
t1.group,
(SELECT GROUP_CONCAT(t3.id,','t3.name,','t3.age SEPARATOR('---') FROM table t3 WHERE t3.id= t2.id GROUP BY t3.id )) AS names,
FROM
table1 AS t1
JOIN table2 AS t2 ON t1.id = t2.id
WHERE
t1.id = 1
I managed to show the result using nested foreach but the results kinda mixed up. Im thinking how to have this. Possibile results
GROUP | ID | NAME | AGE |
--------|----|------|-----|
| 1 | John | 20 |
GROUP1 | 2 | Phil | 22 |
| 3 | Dave | 24 |
--------|----|------|-----|
| 4 | Jan | 20 |
GROUP2 | 5 | Luke | 22 |
the above will show up in html table using php.