Re: SQL problem: bank account

From: "Erik G(dot) Burrows" <eburrows(at)erikburrows(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL problem: bank account
Date: 2003-06-02 16:58:39
Message-ID: 1054573119.13212.41.camel@griffin.jedi-group.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


This is the solution I was looking for! 20 seconds to compile the whole
list.

Thanks everyone for your help, I very much appreciate it. Even though
this is kind of 'hackey' being that it's non-standard SQL, it keeps the
database from having to to 40,000 selects, as would have to do with any
correlated sub-select statement.

Thanks!

> "Erik G. Burrows" <eburrows(at)erikburrows(dot)com> writes:
> > I need to get the most recent transaction for each customer. I need only
> > the transaction ID, but the entire row would be best.
>
> If you don't mind a not-standard-SQL solution, the SELECT DISTINCT ON
> construct is designed for this sort of thing. See the "weather report"
> example in the SELECT reference page.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
--
Erik G. Burrows - KG6HEA www.erikburrows.com
PGP Key: http://www.erikburrows.com/egb(at)erikburrows(dot)com(dot)pgpkey

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2003-06-02 18:27:58 Re: Maintaining a counter up-to-date
Previous Message Jonathan Gardner 2003-06-02 16:40:58 Re: SQL problem: bank account