Re: Subquery to select max(date) value

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
Cc: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Subquery to select max(date) value
Date: 2019-03-28 23:07:09
Message-ID: CAKFQuwaSCp-0EQAhFecEG2meTBA=sbKZ2_9qFxhbG4SPiroSrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 28, 2019 at 4:05 PM Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com> wrote:

>
> (And I don't think the one inside the lateral join is doing you any
>> good). Try:
>>
>
> ...
> a.next_contact is not null
> limit 1) sq
> order by sq.next_contact DESC;
>
>
The fact that the subquery has a LIMT 1 clause leads me to assume the ORDER
BY there is quite necessary.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ken Tanzer 2019-03-28 23:09:21 Re: Subquery to select max(date) value
Previous Message David G. Johnston 2019-03-28 23:05:59 Re: Subquery to select max(date) value