doing math with date function

Поиск
Список
Период
Сортировка
От Johnson, Shaunn
Тема doing math with date function
Дата
Msg-id 73309C2FDD95D11192E60008C7B1D5BB0452E0E3@snt452.corp.bcbsm.com
обсуждение исходный текст
Список pgsql-general

Howdy:

Running Postgres 7.1.3 on RedHat Linux 7.2 kernel
2.4.7 - rev 10.

This has probably asked done a million times over,
but I can't seem to find the examples:

I want to do basic math on a data field (get the
difference in years) but can't find the example
to do it.

What I want is something like:

[pseudo code]

select
name,
dob,
        case
        when now() - dob > '21'
        then 'legal'
        when now() - dob > '18'
        then 'no drinking'
        else 'youths'
end as identify
from temp_table
;

[/pseudo code]

Are there any examples like this?

Thanks!

-X

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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Random Numbers/Letters
Следующее
От: "Andre Lyra"
Дата:
Сообщение: Re: [ODBC] ODBC