1
Select in a Select MySQL
How to select a column within a select and comma seperate the inside select.
CGuild1.com > Tips & Tricks > Select in a Select MySQL

Select in a Select MySQL

SELECT
t1.id, (
    SELECT group_concat(id separator ', ')
    FROM table1 t2
    WHERE t2.sponsor = t1.id
) AS children
FROM table1 t1
GROUP BY t1.id


I found this over here at Stackoverflow.
©2024 CGuild1.com