Date Problem

From: "pauLSiew" <paul(at)mqplayharder(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Date Problem
Date: 2002-02-22 02:39:03
Message-ID: a54b0m$2qvq$1@jupiter.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I'm using pgsql with php, and my query below will retrieve employee's
monthly sales total,

"select sum(salesTotal) from ocf where employeeNo='0123' AND orderDate like
'%$month $year %'" // i put % infront to ignore day, and % at the back to
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
date;

i really confused with the date format......

Anybody got any solution or better idea, pls reply! THANK YOU

Regards,

pauL

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-02-22 03:10:53 Re: all tables in a DB\?
Previous Message Tom Lane 2002-02-22 02:07:14 Re: Trying to convert a TIMESTAMP return value to TIME