Re: Date problem - Mailing list pgsql-general

From missive@frontiernet.net (Lee Harr)
Subject Re: Date problem
Date
Msg-id slrna78rdt.75.missive@whave.frontiernet.net
Whole thread Raw
List 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!


pgsql-general by date:

Previous
From: missive@frontiernet.net (Lee Harr)
Date:
Subject: Re: deleting an identical record
Next
From: Rich Shepard
Date:
Subject: Re: batch file