Re: Query Casting Help
От | Robert L Mathews |
---|---|
Тема | Re: Query Casting Help |
Дата | |
Msg-id | 20020709165052.057713FC330@mail1.tigertech.net обсуждение исходный текст |
Ответ на | Query Casting Help (Hunter Hillegas <lists@lastonepicked.com>) |
Список | pgsql-general |
At 7/8/02 11:51 PM, Hunter Hillegas wrote: >I am trying to execute this little bit: > >(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. The parentheses aren't in quite the right place. Try: extract(month from (current_date + interval '1 month')) That is, you want to add 1 month to the current date first (adding a date and an interval), then extract the month number from the result of that. Your version extracted the month integer first -- "8" -- then tried adding an interval to it, but it doesn't make sense to add integers and intervals together. ------------------------------------ Robert L Mathews, Tiger Technologies
В списке pgsql-general по дате отправления: