Received: from all.all.ee (puu.all.ee [194.204.49.113]) by hub.org (8.10.1/8.10.1) with ESMTP id e5SA51165809 for ; Wed, 28 Jun 2000 06:05:02 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by all.all.ee (8.9.3/8.9.3) with ESMTP id NAA10272 for ; Wed, 28 Jun 2000 13:04:56 +0300 Date: Wed, 28 Jun 2000 13:04:56 +0300 (EEST) From: Antti Linno To: pgsql-sql@postgresql.org Subject: extract last months data Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200006/253 Lo. Today I digged in manuals and other docs, but didn't find any hint, how to get data from table, where some cols are in date or datetime format, and the data was about last month, or about special month. Psql help was unhelpful too. Here's example: In table workers is data with different date. When I need to make summary, I just want to extract last months data, but I don't know whether the month ended with 29,30 or 31 (external program, that uses postgres), so I cant use select * from workers where date<31.1.2000 and date>1.1.2000 I think I can get month and year number at least, but I can't use mday attribute. All suggestions are welcome :P Stucked alligator :)