Calculating the age of a person

Поиск
Список
Период
Сортировка
От Hans-Jürgen Schönig
Тема Calculating the age of a person
Дата
Msg-id 3B052603.ADBEB496@cybertec.at
обсуждение исходный текст
Список pgsql-sql
I have a table containing the birthdays of various persons. The target
is to compute the age of a persons.

persons=# SELECT age(birth), * FROM persons LIMIT 1;             age              | id |  name  |   birth    | gender
|
income
-------------------------------+----+--------+------------+--------+--------
31 years 4 mons 16 days 23:00 |  1 | Albert | 1970-01-01 | m      |
35000
(1 row)

When I use age() I don't get full years. Is there an easy way to round
::reltime off or up without writing a function. Is there any possibility
to use plain SQL only?
   Hans



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

Предыдущее
От: Giorgio Valoti
Дата:
Сообщение: Re: has anyone tried running in MAC OS X
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Inherited tables: How stable is that feature?