Re: Refining query statement

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Refining query statement
Date: 2019-01-17 16:36:53
Message-ID: CAKFQuwZFgogSc1Td0hXz7Jtzn3YvFisDEnPL6+3NLO1O7hsnkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 17, 2019 at 9:14 AM Rich Shepard <rshepard(at)appl-ecosys(dot)com> wrote:
> ORDER BY c.contact_id, a.next_contact DESC;

> The WHERE clause needs to exclude a contact_id where the most current row in
> Activities has NULL for the next_contact column.

Why is next_contact allowed to be null?

Your concept of "most current row" is strictly based upon next_contact
so if next_contact is null it is impossible to know whether it is the
most current row (consider that two activities could be missing the
next_contact date - which of those is the most current?)

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-01-17 16:41:26 Re: Refining query statement
Previous Message Adrian Klaver 2019-01-17 16:27:51 Re: Refining query statement