------=_Part_12239_30928979.1209048220838
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Actually I want to select all rows whith dates between first day of the
month 00:00:00 and last date of the month 23:59:59
On Thu, Apr 24, 2008 at 4:15 PM, Colin Wetherbee <cww@[EMAIL PROTECTED]
>
wrote:
> Frank Bax wrote:
>
> > Frank Bax wrote:
> >
> > > Nacef LABIDI wrote:
> > >
> > > > is there a better method to retrieve all the rows with dates in
the
> > > > current month.
> > > >
> > >
> > > select * from mytable where extract(month from mydate) =
extract(month
> > > from now()) and extract(year from mydate) = extract(year from
now());
> > >
> >
> > Sorry; I was not thinking clearly - date_trunc is better for this:
> >
> > select * from mytable where date_trunc('month',mydate) =
> > date_trunc('month',now());
> >
>
> I have some code that uses extract() for this sort of thing. Would you
> mind explaining how date_trunc() is better for this?
>
> Most of my extract() results end up in <select> drop-down boxes in HTML.
>
> Thanks.
>
> Colin
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
------=_Part_12239_30928979.1209048220838
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Actually I want to select all rows whith dates between first day of the
month 00:00:00 and last date of the month 23:59:59<br><br><div
class="gmail_quote">On Thu, Apr 24, 2008 at 4:15 PM, Colin Wetherbee
<<a href="mailto:cww@[EMAIL PROTECTED]
">cww@[EMAIL PROTECTED]
>>
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Frank Bax
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;">
Frank Bax wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;"><div class="Ih2E3d">
Nacef LABIDI wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;">
is there a better method to retrieve all the rows with dates in the
current month.<br>
</blockquote>
<br></div>
select * from mytable where extract(month from mydate) = extract(month
from now()) and extract(year from mydate) = extract(year from now());<br>
</blockquote>
<br>
Sorry; I was not thinking clearly - date_trunc is better for this:<br>
<br>
select * from mytable where date_trunc('month',mydate) =
date_trunc('month',now());<br>
</blockquote>
<br>
I have some code that uses extract() for this sort of thing. Would
you mind explaining how date_trunc() is better for this?<br>
<br>
Most of my extract() results end up in <select> drop-down boxes in
HTML.<br>
<br>
Thanks.<br>
<br>
Colin<br><font color="#888888">
<br>
<br>
-- <br>
Sent via pgsql-sql mailing list (<a href="mailto:pgsql-sql@[EMAIL PROTECTED]
"
target="_blank">pgsql-sql@[EMAIL PROTECTED]
>)<br>
To make changes to your subscription:<br>
<a href="http://www.postgresql.org/mailpref/pgsql-sql"
target="_blank">http://www.postgresql.org/mailpref/pgsql-sql</a><br>
</font></blockquote></div><br>
------=_Part_12239_30928979.1209048220838--


|
15 Posts in Topic:
|
nacef.l@[EMAIL PROTECTED] |
2008-04-24 14:59:47 |
|
fbax@[EMAIL PROTECTED]
( |
2008-04-24 09:06:25 |
|
fbax@[EMAIL PROTECTED]
( |
2008-04-24 09:16:03 |
|
andreas.kretschmer@[EMAIL |
2008-04-24 15:15:36 |
|
cww@[EMAIL PROTECTED]
(C |
2008-04-24 10:15:23 |
|
erik@[EMAIL PROTECTED]
( |
2008-04-24 09:41:04 |
|
nacef.l@[EMAIL PROTECTED] |
2008-04-24 16:43:40 |
|
scott.marlowe@[EMAIL PROT |
2008-04-24 08:55:31 |
|
fhevia@[EMAIL PROTECTED]
|
2008-04-24 12:10:34 |
|
scott.marlowe@[EMAIL PROT |
2008-04-24 08:56:50 |
|
erik@[EMAIL PROTECTED]
( |
2008-04-24 10:08:10 |
|
scott.marlowe@[EMAIL PROT |
2008-04-24 09:16:01 |
|
scott.marlowe@[EMAIL PROT |
2008-04-24 09:44:44 |
|
fhevia@[EMAIL PROTECTED]
|
2008-04-24 13:07:19 |
|
nacef.l@[EMAIL PROTECTED] |
2008-04-24 18:39:06 |
|