pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pauLSiew <paul@mqplayharder.com>
To: pgsql-sql@postgresql.org
Subject: Date Problem
Date: Fri, 22 Feb 2002 10:39:03 +0800
Message-ID: <a54b0m$2qvq$1@jupiter.hub.org> (raw)

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






view thread (10+ messages)  latest in thread

Message-ID: <a54b0m$2qvq$1@jupiter.hub.org>
Permalink:  ../a54b0m$2qvq$1@jupiter.hub.org/
Also on:    postgresql.org/message-id/a54b0m$2qvq$1@jupiter.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: paul@mqplayharder.com
  Subject: Re: Date Problem
  In-Reply-To: <a54b0m$2qvq$1@jupiter.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox