Reputation: 167
I have a postgres table that's effectively stores linked lists, but none of the rows have a list identifier. So it's hard to pick out lists from table, other than to "hop" to each node.
create table exchange_history (
curr_node_id integer,
prev_node_id integer, -- This is NULL for the first node in the list.
description text -- (Just an example)
)
How would I do the following:
The table contains link lists, so there isn't multiple nodes having the same prev_node_id.
(This isn't homework or an interview question, I genuinely interested in knowing how to do this, but I also have some customer tables that I need to query that are effectively like this.)
Thanks.
Upvotes: 0
Views: 34