X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E71C630EDD7 for ; Mon, 16 Jun 2003 17:21:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 28159-05 for ; Mon, 16 Jun 2003 14:21:07 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 4C45C30EF00 for ; Mon, 16 Jun 2003 14:21:06 -0300 (ADT) Received: (qmail 3005 invoked by uid 500); 16 Jun 2003 17:24:02 -0000 Date: Mon, 16 Jun 2003 12:24:02 -0500 From: Bruno Wolff III To: javier garcia - CEBAS Cc: pgsql-sql@postgresql.org Subject: Re: date question Message-ID: <20030616172402.GA2940@wolff.to> Mail-Followup-To: javier garcia - CEBAS , pgsql-sql@postgresql.org References: <200306131130.h5DBUiI06008@natura.cebas.csic.es> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200306131130.h5DBUiI06008@natura.cebas.csic.es> User-Agent: Mutt/1.5.4i X-Archive-Number: 200306/156 X-Sequence-Number: 13914 On Fri, Jun 13, 2003 at 13:44:09 +0200, javier garcia - CEBAS wrote: > > And I've got another related tables with a date field. I need to compare the > dates field in the other tables with "year", "month", "day" in this table. > > Is there a way to create a table from this table, directly in Postgres in > which a date field is created based in the values of "year", "month", "day" > in this table? Yes. You could concatenate the values for year, month and day and cast the resulting string to date. In the long run you might be better storing the dates as dates in the table and extracting the year, month and day when reporting (or perhaps using a view to add them as additional columns).