Received: from jupiter.hub.org (jupiter.hub.org [64.49.215.5]) by postgresql.org (Postfix) with ESMTP id 85277475AC2 for ; Thu, 21 Feb 2002 21:40:57 -0500 (EST) Received: (from news@localhost) by jupiter.hub.org (8.11.6/8.11.6) id g1M2dJG93210 for pgsql-sql@postgresql.org; Thu, 21 Feb 2002 20:39:19 -0600 (CST) (envelope-from news) From: "pauLSiew" X-Newsgroups: comp.databases.postgresql.sql Subject: Date Problem Date: Fri, 22 Feb 2002 10:39:03 +0800 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 29 Message-ID: X-Complaints-To: news@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 To: pgsql-sql@postgresql.org X-Archive-Number: 200202/308 X-Sequence-Number: 6730 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