(mysql btw)
Hi, I'm wondering how I can sort parent and children into an html table with just one query...
I have a table, lets say it has ID, parentID, listPOSITION, and data values
ID = id of entry (1,2,3,...)
parentID = id of parent (1,2,3,...)
listPOSITION = position under parent (1,2,3,...)
data = some text
how can I group them when extracting so my table shows up something like
parent1
---p1child1
---p1child2
---p1child3
parent2
---p2child1
...basically so children go under their parents and I can differentiate between parent and children cells for styling. Is this possible with just one query SELECT * FROM table and some clever looping?
If not, anyone know the next best way?
I know how to do it with many many queries, but want to be as efficient as possible.
please point me in the right direction... thanks!🙂