Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id CCAFD9FB9C9 for ; Fri, 20 Apr 2007 09:35:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 38436-07 for ; Fri, 20 Apr 2007 09:35:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by postgresql.org (Postfix) with ESMTP id E54639FB9F1 for ; Fri, 20 Apr 2007 09:35:51 -0300 (ADT) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), id 0MKwpI-1HesL32EU4-00046B; Fri, 20 Apr 2007 14:35:49 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1HesL2-0007W1-00 for pgsql-sql@postgresql.org; Fri, 20 Apr 2007 14:35:44 +0200 Date: Fri, 20 Apr 2007 14:35:44 +0200 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: Retrieve month from date Message-ID: <20070420123544.GG15322@a-kretschmer.de> References: <11604f180704200519h5d858f6ey1efbbccd52ccd0c9@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11604f180704200519h5d858f6ey1efbbccd52ccd0c9@mail.gmail.com> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX19P+tcegrDRu9YUNE8vX9OpxJfKkHfk9FuxKwK 1sGrDmhidI0GOq+iIMAI3bGiS+odfYeuS7xQn2kRVVAS9Vz7CR XLf/4o1xrnn6ZbQnJkFaJyzPihBqpyh X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/180 X-Sequence-Number: 28180 am Fri, dem 20.04.2007, um 17:49:33 +0530 mailte Rohit Khare folgendes: > I am using PGSQL 8.2.3 on Windows XP. > > I have a table called "StudentFeesPayment" with columns "ReceiptNo" and > "ReceiptMonthYear". > The column, "ReceiptMonthYear" stores date in the format "yyyy-mm-dd". I have > to find the max(ReceiptNo) where Month of (ReceiptMonthYear)=4. Or whatever > month I give. > > I tried: > > Select max(ReceiptNo) from StudentFeesPayment where Extract(Month > ('ReceiptMonthYear'))=4; > > But it is not working. How to do it? ... where extract(month from "ReceiptMonthYear") = 4 Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net