How to get the top most parent in PostgreSQL
- by wereach
I have a tree structure table with columns:
id,parent,name.
Given a tree A-B-C,
how could i get the most top parent A's ID according to C's ID?
Especially how to write SQL with "with recursive"?
Thanks!