Re: agregates - Mailing list pgsql-general

From Jean-Luc Lachance
Subject Re: agregates
Date
Msg-id 3E3056D4.44603C61@nsd.ca
Whole thread Raw
In response to Re: agregates  (Andrew Sullivan <andrew@libertyrms.info>)
Responses Re: agregates
List 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

pgsql-general by date:

Previous
From: "Frankie"
Date:
Subject: Is there a way knowing which database I'm connecting to?
Next
From: trainee12@yeah.net
Date:
Subject: Re: varchar and spaces problem