Re: agregates

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: Andrew Sullivan <andrew(at)libertyrms(dot)info>, David Blood <david(at)matraex(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: agregates
Date: 2003-01-23 20:55:48
Message-ID: 3E3056D4.44603C61@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(at)libertyrms(dot)info> M2P 2A8
> +1 416 646 3304 x110
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2003-01-23 20:56:49 Optimizer too eager to choose full table scans
Previous Message scott.marlowe 2003-01-23 20:52:41 Re: <no subject>