Quickie:
Table structure:
id | name | parent_id
I want to run a query for ID’s, but also return that item’s parent_id and the name of that id as well.
To better explain
SELECT id, name FROM sections
…then for each ID, return the ID and name of its parent using the ‘parent_id’ column.
I’m trying to get this into an array:
[0] [id] [name] [parent_id] [parent_name]
This should work:
Basically you just want to join the table against itself and bring in the name field as the parent name.