From: | Thomas Lockhart <lockhart(at)fourpalms(dot)org> |
---|---|
To: | Hunter Hillegas <lists(at)lastonepicked(dot)com> |
Cc: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Query Casting Help |
Date: | 2002-07-09 14:20:19 |
Message-ID: | 3D2AF123.4B8EC067@fourpalms.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Marc G. Fournier | 2002-07-09 14:21:57 | Re: I am being interviewed by OReilly |
Previous Message | Bruce Momjian | 2002-07-09 14:08:26 | Re: Query Analyzing |