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@erikburrows.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@erikburrows.com.pgpkey