Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2CJovx53499 for ; Mon, 12 Mar 2001 14:50:57 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f26MU8x93667 for ; Tue, 6 Mar 2001 17:30:08 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f26MPDW77644 for pgsql-sql@postgresql.org; Tue, 6 Mar 2001 17:25:13 -0500 (EST) (envelope-from news) From: David Lynn X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Comparing dates Date: Tue, 06 Mar 2001 14:24:30 -0800 Organization: Ayamba Lines: 59 Message-ID: <3AA5639E.62B27772@ayamba.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: scrappy@hub.org X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en To: pgsql-sql@postgresql.org X-Archive-Number: 200103/224 X-Sequence-Number: 1878 Hello - It seems that using BETWEEN would work well, especially for finding dates between two other dates. WHERE date_date BETWEEN '03-02-2001'::date and '03-03-2001'::date --d > On Tue, 6 Mar 2001, Markus Fischer wrote: > > > Hello, > > > > I've a SELECT statement on many joined Tabled and one of them has > > a date column called 'date_date'. When I fetch a date e.g. > > '02-03-2001', I get, say, 60 results back. When I now perform the > > same query with another date, lets take '03-03-2001', I get back > > about 70 results. > > > > When I now modify my query to get both results in one I write > > > > SELECT > > .... > > FROM > > .. > > AND > > date_date >= '2001-03-02' > > AND > > date_date <= '2001-03-03' > > AND > > .... > > > > I think I should get back the rows for both days, 60 + 70 makes > > 130 to me. But what I get back is even smaller then 60. I > > allready tried TO_DATE conversion, an OR construct but always > > the same result. > > > > Is there something special to know when comparing/working with > > date-datetypes ? > > > > > > kind regards, > > Markus > > > > -- > > Markus Fischer, http://josefine.ben.tuwien.ac.at/~mfischer/ > > EMail: mfischer@josefine.ben.tuwien.ac.at > > PGP Public Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc > > PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0 > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 2: you can get off all lists at once with the unregister command > > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)