Re: Subquery to select max(date) value - Mailing list pgsql-general

From Rich Shepard
Subject Re: Subquery to select max(date) value
Date
Msg-id alpine.LNX.2.20.1903281612410.19962@salmo.appl-ecosys.com
Whole thread Raw
In response to Re: Subquery to select max(date) value  (Ken Tanzer <ken.tanzer@gmail.com>)
Responses Re: Subquery to select max(date) value  (Ken Tanzer <ken.tanzer@gmail.com>)
List pgsql-general
On Thu, 28 Mar 2019, Ken Tanzer wrote:

> You need the ORDER BY in the outer join.

Ken,

I thought so. But, ...

> (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;

This re-orders the returned set, but still not in chronological order.

Thanks,

Rich



pgsql-general by date:

Previous
From: Ken Tanzer
Date:
Subject: Re: Subquery to select max(date) value
Next
From: Rich Shepard
Date:
Subject: Re: Subquery to select max(date) value