Re: Refining query statement

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Refining query statement
Дата
Msg-id 57b49280-c415-f304-f0b5-3b76d8627cc9@aklaver.com
обсуждение исходный текст
Ответ на Re: Refining query statement  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Refining query statement  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
On 1/17/19 10:01 AM, Rich Shepard wrote:
> On Thu, 17 Jan 2019, Adrian Klaver wrote:
> 
>> Seems to me a boolean field of name active to denote contacts you need to
>> keep up with is in order. Then make the next_contact field NOT NULL and
>> replace the current NULL values with 'infinity':
> 
>> WHERE COALESCE(next_contact, 'infinity') BETWEEN '01/01/2019'::date AND
>> 'today'::date
> 
> Adrian,
> 
>    Having added a new column, 'active' with boolean values (and a 
> default of
> true), would this WHERE clause work:
> 
> WHERE active = TRUE and next_contact <= 'today'::date

It would produce results, so yes it would work.

The question are they the results you want?

The above would return anything with a next_contact less then today. 
That could extend backwards to some undetermined point in the past, 
depending on how diligent you where on updating next_contact. Before you 
go much further I would look over the suggestions posted and then sit 
down with pen and paper and figure out what it you want to track and how 
you are going to maintain that tracking. Then draw up an outline of how 
you will achieve that in code.

> 
> ?
> 
> Regards,
> 
> Rich
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: Rich Shepard
Дата:
Сообщение: Re: Refining query statement
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Refining query statement