pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Subquery to select max(date) value
Date: Wed, 13 Feb 2019 12:29:25 -0500
Message-ID: <dcb38a6d-de22-4378-85b5-5255dfb6dd69@www.fastmail.com> (raw)
In-Reply-To: <alpine.LNX.2.20.1902130902230.10544@salmo.appl-ecosys.com>
References: <alpine.LNX.2.20.1902121414490.15295@salmo.appl-ecosys.com>
	<2780074d-3b87-b154-8bc6-a0f898fbdde2@openvistas.net>
	<alpine.LNX.2.20.1902121443290.15295@salmo.appl-ecosys.com>
	<alpine.LNX.2.20.1902121446460.15295@salmo.appl-ecosys.com>
	<CAD3a31U1_V0z9X22wD=1FQ9iYr+KbY8J3NxQpk0Q5Dq5M151fw@mail.gmail.com>
	<alpine.LNX.2.20.1902121513500.15295@salmo.appl-ecosys.com>
	<CAD3a31VPA6FTLWyQ5KGVXF6ac0y=VG9UaJLEdvyBZWCefrSisw@mail.gmail.com>
	<alpine.LNX.2.20.1902130623150.10544@salmo.appl-ecosys.com>
	<fcc4bce0-6e59-d9eb-3644-548b993b84fd@aklaver.com>
	<alpine.LNX.2.20.1902130736190.10544@salmo.appl-ecosys.com>
	<d8d0e0f6-fcbc-e53d-2ead-a6c8eb417c95@aklaver.com>
	<alpine.LNX.2.20.1902130902230.10544@salmo.appl-ecosys.com>

On Wed, Feb 13, 2019, at 9:06 AM, Rich Shepard wrote:
> On Wed, 13 Feb 2019, Adrian Klaver wrote:
> 
> > Should have been clearer in my previous post, you can get rid of the nulls
> > by filtering out the entire row.
> 
> Adrian,
> 
> Thank you. I'm rebuilding the statement from the inside out (which helps me
> learn more SQL in the process). For example,
> 
> select * from activities where next_contact is not null and
>           next_contact <= 'today' and next_contact > '2018-12-31';
> 
> works as written. This suggests that it's the placement within the two joins
> that needs correcting. Now I'll add the two joined tables one at a time and
> learn how to structure the whole statement.


It will work if you use it to filter after the joins are done.

> 
> Best regards,
> 
> Rich
> 
> 
>




view thread (48+ messages)  latest in thread

Message-ID: <dcb38a6d-de22-4378-85b5-5255dfb6dd69@www.fastmail.com>
Permalink:  ../dcb38a6d-de22-4378-85b5-5255dfb6dd69@www.fastmail.com/
Also on:    postgresql.org/message-id/dcb38a6d-de22-4378-85b5-5255dfb6dd69@www.fastmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com
  Subject: Re: Subquery to select max(date) value
  In-Reply-To: <dcb38a6d-de22-4378-85b5-5255dfb6dd69@www.fastmail.com>
  References: <alpine.LNX.2.20.1902121414490.15295@salmo.appl-ecosys.com> <2780074d-3b87-b154-8bc6-a0f898fbdde2@openvistas.net> <alpine.LNX.2.20.1902121443290.15295@salmo.appl-ecosys.com> <alpine.LNX.2.20.1902121446460.15295@salmo.appl-ecosys.com> <CAD3a31U1_V0z9X22wD=1FQ9iYr+KbY8J3NxQpk0Q5Dq5M151fw@mail.gmail.com> <alpine.LNX.2.20.1902121513500.15295@salmo.appl-ecosys.com> <CAD3a31VPA6FTLWyQ5KGVXF6ac0y=VG9UaJLEdvyBZWCefrSisw@mail.gmail.com> <alpine.LNX.2.20.1902130623150.10544@salmo.appl-ecosys.com> <fcc4bce0-6e59-d9eb-3644-548b993b84fd@aklaver.com> <alpine.LNX.2.20.1902130736190.10544@salmo.appl-ecosys.com> <d8d0e0f6-fcbc-e53d-2ead-a6c8eb417c95@aklaver.com> <alpine.LNX.2.20.1902130902230.10544@salmo.appl-ecosys.com> <dcb38a6d-de22-4378-85b5-5255dfb6dd69@www.fastmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox