Re: Selecting table row with latest date

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Selecting table row with latest date
Date: 2021-08-20 07:22:04
Message-ID: CA+bJJbx2kV=nDNB9zxBhMzgNaYLH-4nCh98y7boH-vkYCaUPeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rich:

On Thu, Aug 19, 2021 at 6:59 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com> wrote:
> On Thu, 19 Aug 2021, Rob Sargent wrote:
> > Yeah, but my quibble is the the table you described up-thread. Your
> > contact table contains next_contact? I think that column should be
> > normalized out.
> Why should I have a separate table with one column: next_contact? The
> next_contact date is associated with a person and the date that person was
> contacted.

Is your next_contact really dependent on the contact record (
person+contact_date? ).

I mean, your tables seem CRM like. You stated next_contact for old
contacts is not interesting. It seems next_contact is associated just
by a person, something like this:

You contact person 1 on april 2, decide to follow up on june 2 =>
insert ( p=1, cd=20210402, nc=20210602 ).

Case 1: You contact it in 20210603 , followup for mid july:
Insert (1, 20210603, 20210715).
Is the nc for the previous record useful for anything ? ( It seems
to be nor useful for calling, but you may want to do reports to see
next-contact correlation with the contacts on another records )

Case 2: You contact in mid may ( for whatever reason, he calls you,
whatever, you insert a record for follow up in July ( 1,20210515,
20210715).
Is the next contact date for june still valid?

To me, and maybe others, it seems there is only one valid next-contact
date, potentially null, which should go in the person record, and may
be the contacts table should capture the value of next-contact at the
time the contact was made for analysis. This also makes finding
contacts to be made soon easier.

Of course no separate table for next-contact.

Francisco Olarte.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Li EF Zhang 2021-08-20 11:01:48 Make bloom extension trusted, but can not drop with normal user
Previous Message Laurenz Albe 2021-08-20 05:29:38 Re: PostgreSQL 9.2 high replication lag