Re: Refining query statement

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Re: Refining query statement
Дата
Msg-id alpine.LNX.2.20.1901171559400.18965@salmo.appl-ecosys.com
обсуждение исходный текст
Ответ на Re: Refining query statement  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
On Thu, 17 Jan 2019, Adrian Klaver wrote:

> I would think the active would be on People or Organizations. Then you can
> eliminate then from the query results before you ever got to the contact
> history.

Adrian,

Excellent point. I don't know why I put active in the contacts table as it
does make more sense to put it in the people table (as some clients have
multiple sites, each with its own contact person).

> Also not sure how you the above result when the query showed:
> WHERE c.active = TRUE AND c.next_contact <= 'today'::date
> Or did the history results come from an undisclosed query?

I don't recall which query I used for the MWE. I'll move the active column
to the new table, as well as those values, and keep working on learning how
to formulate complex, multi-table queries.

Also, moving the active table to peoples, where there is only one row per
person (rather than multiple contact rows per person) removes the need to
find only the most recent row in the many of the one-to-many relationship.

Thanks for the advice,

Rich



В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Refining query statement
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Refining query statement