Re: Date problem

From: "pauLSiew" <paul(at)mqplayharder(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Date problem
Date: 2002-02-22 01:57:24
Message-ID: a548ij$5qn$1@jupiter.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > "select sum(salesTotal) from ocf where employeeNo='0123' AND orderDate
like
> > '%$month $year %'" // i put % infront to ignore day, and % at the back
to
>
> How about
> ... like '%$month-$year%' ...
>
>
> > ignore the time (because i'm using timestamp with timezone), then i
shall
> > get particular month's records.
> >
> > $month = Feb
> > $year = 2002
> >
> > But i cant retrieve the data, if i take out the $year, it works...but i
> > need the year to identify the records.
> >
> > it works when i do a direct sql query to the pgsql through pg-admin, the
> > query are like this,
> > select grand_total,ocf_no,date from ocf where date like '2002-01%' order
by
>
> Here, you have the dash between month and year ................^
> You also have year and month reversed from above... Could be trouble!
>
it works when i put '%$month%', but this will only retrieve the month, but
any year, cause year din't specified, so i put the $year in like the 1st
query above, it's did not work, then i try all the possible, it dont work
also :(

$month=Feb, not 02

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-02-22 02:01:33 Re: Follow Up: How to properly build postgresql version 7.2 on Unix Platforms?
Previous Message Lee Harr 2002-02-22 01:54:42 Re: Createdb problems