timespan question: using value from row in select

Поиск
Список
Период
Сортировка
От Michael Olivier
Тема timespan question: using value from row in select
Дата
Msg-id 362BE4D4.37DBE055@dnai.com
обсуждение исходный текст
Список pgsql-sql
Hi folks,

I'm trying to write a SELECT statement that uses a min_age column
(integer expressing a number of years) as part of a timespan:

select * from users U where
   age('now', '01-01-1970') >= timespan('U.min_age years'::timespan);
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^

ERROR:  parser: parse error at or near "error"


Is there some way to do this? I want to convert an int expressing years
into a timespan, within a select statement.

Thanks for any insights on how to do this.

--Michael

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

Предыдущее
От: "Bryan White"
Дата:
Сообщение: Defaulting to current date
Следующее
От: Pascal Forget
Дата:
Сообщение: Index on VARCHAR faster than TEXT?