Re: Subquery to select max(date) value

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: "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:14:07
Message-ID: alpine.LNX.2.20.1903281612410.19962@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2019-03-28 23:21:45 Re: Subquery to select max(date) value
Previous Message Ken Tanzer 2019-03-28 23:09:21 Re: Subquery to select max(date) value