From: | Robert L Mathews <lists(at)tigertech(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Cc: | <lists(at)lastonepicked(dot)com> |
Subject: | Re: Query Casting Help |
Date: | 2002-07-09 16:50:52 |
Message-ID: | 20020709165052.057713FC330@mail1.tigertech.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2002-07-09 17:05:55 | Re: (A) native Windows port |
Previous Message | Stephan Szabo | 2002-07-09 16:48:38 | Re: update problem? |