Received: from smtp.stellison.co.uk ([212.56.66.225]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eBJKD9616246 for ; Tue, 19 Dec 2000 15:13:09 -0500 (EST) (envelope-from francis@stellison.co.uk) Received: (qmail 26749 invoked from network); 19 Dec 2000 20:13:42 -0000 Received: from unknown (HELO neo) (unknown) by unknown with SMTP; 19 Dec 2000 20:13:42 -0000 From: "Francis Solomon" To: "Jeff MacDonald" , "Pgsql-Sql@Postgresql. Org" Subject: RE: substring .. Date: Tue, 19 Dec 2000 20:14:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Importance: Normal X-Archive-Number: 200012/225 X-Sequence-Number: 561 Hi Jeff, '2000-12-14' is only 10 chars long. You're asking for an 11-char long substring to match a 10-char ... not going to happen! You can see this better if you do something like this ... select '@' || substr(datefoo,1,11) || '@' from table; ... and you'll get results like: @2000-12-14 @ So, you could modify your query to do: select foo from table where substr(datefoo, 1, 10) = '2000-12-14'; Alternatively, what's wrong with this approach? select foo from table where date(datefoo) = '2000-12-14'; I think that might execute a little faster. Hope this helps Francis Solomon > hi folks.. > > i want to do this to a datetime field.. > > select foo from table where substr(datefoo,1,11) = '2000-12-14'; > > it returns no results yet.. > > select substr(datefoo,1,11) does return some values that say > 2000-12-14 > > any clues ? > > Jeff MacDonald,