| От | Thomas Lockhart |
|---|---|
| Тема | Re: Query Casting Help |
| Дата | |
| Msg-id | 3D2AF123.4B8EC067@fourpalms.org обсуждение исходный текст |
| Ответ на | Query Casting Help (Hunter Hillegas <lists@lastonepicked.com>) |
| Список | pgsql-general |
> (extract(month from current_date) + interval '1 month')
> The system says I need to cast because it can't figure out how to add
> these... I read through the manual and I am still a little confused.
> Which side should I be casting? To what datatype?
What are you hoping to get as a result? A date, or an interval? The
extract() function returns a double-precision value for the field (the
month in this case) so doesn't give anything for the interval to work
with.
If you want a date, then you might want something like
(date_trunc('month', current_date) + interval '1 month')
hth
- Thomas
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера