Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C26B26327E5 for ; Wed, 12 Aug 2009 00:59:29 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 42070-02 for ; Wed, 12 Aug 2009 03:59:25 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from renaissance-it.com (mail.renaissance-it.com [164.164.87.55]) by mail.postgresql.org (Postfix) with ESMTP id 7B69D62F435 for ; Wed, 12 Aug 2009 00:59:22 -0300 (ADT) Received: (qmail 1501 invoked by uid 109); 12 Aug 2009 03:59:46 -0000 Received: from 192.168.1.6 by Mailsrv (envelope-from , uid 112) with qmail-scanner-1.25st (spamassassin: 3.1.7-deb. perlscan: 1.25st. Clear:RC:1(192.168.1.6):. Processed in 0.052997 secs); 12 Aug 2009 03:59:46 -0000 Received: from unknown (HELO ramasubramanian) (ramasubramanian.g@[192.168.1.6]) (envelope-sender ) by renaissance-it.com (qmail-ldap-1.03) with SMTP for ; 12 Aug 2009 03:59:46 -0000 Message-ID: <207AA50147184F3885AB00BE4BA6CE0A@ramasubramanian> From: "ramasubramanian" To: "Bor" , References: <24917400.post@talk.nabble.com> Subject: Re: Month/year between two dates Date: Wed, 12 Aug 2009 09:29:38 +0530 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.184 tagged_above=-10 required=5 tests=BAYES_40=-0.185, STOX_REPLY_TYPE=0.001 X-Spam-Level: X-Archive-Number: 200908/54 X-Sequence-Number: 32963 Dear Bor, How you will 1 record for 2009/05 (if you use 2009/05 ) it will fetch all the records as it is not having month 05 am i correct? ----- Original Message ----- From: "Bor" To: Sent: Tuesday, August 11, 2009 6:43 PM Subject: [SQL] Month/year between two dates > > Hi to all, > > I have a very simple question. Let's say that I have three records (id, > date > from, date to): > > 1 2009-01-01 2009-08-31 > 2 2009-08-01 2009-08-10 > 3 2009-08-11 2009-08-31 > > Now I want to get records, "related" to a single month/year data (two > integers). For 2009/08 (int1 = 2009, int2 = 8) I should get all three > records, for 2009/05 only record 1, but for 2009/11 none of the records. > > Is there any simple way to do this? A query would do :). > > Thanks alot. > -- > View this message in context: > http://www.nabble.com/Month-year-between-two-dates-tp24917400p24917400.html > Sent from the PostgreSQL - sql mailing list archive at Nabble.com. > > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql