u/lexum1

Self join with parent

I have a groups table with a parent_id column so I can have records like 1. Colors, 2. Red and 3. Blue (Red and Blue have a parent_id of 1 linking to Colors).

Querying the Colors record and joining the same table will return Colors with its children (Red and Blue).

.select(“*, groups!parent_id(*)”)

How do I query Red so it retrieves Red with its parent Colors?

Thanks

reddit.com
u/lexum1 — 4 days ago