[SQL] Join table with itself for heirarchial system?

2003-07-19 Thread Benjamin Smith
Can you query a set of nested entries to simulate a heirarchial system with a single query? I'm building a nested category table with a definition like below" CREATE TABLE category ( id serial, parent integer not null, title varchar); Idea is that we can "nest" categories so that we have

[SQL] Accumulative Queries?

2002-12-02 Thread Benjamin Smith
Let's say you have a table of Financial transactions: Create table checks ( id serial, number varchar, to varchar, amount real, date integer ); (date is an epoch timestamp) And you want to get a listing of checks "SELECT * FROM checks ORDER BY date ASC"; but you also want to have an