Does PostgreSQL support self joining or is there another way to solve this?
For example, lets say I have a single table (table a
) with the following columns:
id name supid
------------------------
1 a 2
2 b 3
3 c 4
4 d 5
.. .. ..
Is there a way to output the data in the following format?
id name sup name
-------------------------
1 a b
2 b c
3 c d
4 d ..
.. .. ..