Re: agregates

Jean-Luc Lachance <jllachan@nsd.ca>

From: Jean-Luc Lachance <jllachan@nsd.ca>
To: Andrew Sullivan <andrew@libertyrms.info>, David Blood <david@matraex.com>
Cc: pgsql-general@postgresql.org
Date: 2003-01-23T20:55:48Z
Lists: pgsql-general
Sure it does!

select customersid, paymentid 
from tblpayment p1
where paymentdebit > 0 and paymentid = ( 
  select paymentid 
  from tblpayment p2 
  where p2.paymentdebit > 0 and p2.customerid = p1.customerid 
  order by paymentid desc limit 1 offset 1);

JLL


Andrew Sullivan wrote:
> 
> On Wed, Jan 22, 2003 at 05:15:44PM -0500, Eric B. Ridge wrote:
> >
> > wouldn't you want LIMIT 2 OFFSET 1 ?
> 
> No, he only wants one record.  But actually, he wanted one record per
> customer, so my suggestion didn't help.
> 
> A
> --
> ----
> Andrew Sullivan                         204-4141 Yonge Street
> Liberty RMS                           Toronto, Ontario Canada
> <andrew@libertyrms.info>                              M2P 2A8
>                                          +1 416 646 3304 x110
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org