Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 03417475D17 for ; Sat, 19 Oct 2002 21:12:57 -0400 (EDT) Received: from technovell.com (213-97-10-232.uc.nombres.ttd.es [213.97.10.232]) by postgresql.org (Postfix) with ESMTP id 62AB7475CCE for ; Sat, 19 Oct 2002 21:12:55 -0400 (EDT) Received: from technovell.com yapt@technovell.com [192.168.1.200] by technovell.com with Novell NIMS $Revision: 2.88.1.1 $ on Linux; Sun, 20 Oct 2002 03:12:40 +0100 Message-ID: <3DB2032A.496345A1@technovell.com> Date: Sun, 20 Oct 2002 03:13:14 +0200 From: Terry Yapt X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Restricting a VIEW. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/251 X-Sequence-Number: 9968 Hello all, I have a doubt. In the next example, I have a table with two columns: - DATE - MONEY And a VIEW which SUM's the money GROUPing by 'month/year' (I cut off the day)... Ok.. I would like to be able to SELECT * FROM VIEW.. but restricting by complete dates (dd/mm/yyyy)... (Last select in the example) I think it isn't possible, but I would like to know your opinion... Or if there is any workaround... Best regards.. --============================== DROP TABLE ty_test; CREATE TABLE ty_test (datein date NOT NULL, money numeric(6,2) NOT NULL, PRIMARY KEY (datein) ) WITHOUT OIDS; INSERT INTO ty_test VALUES ('2002/10/01',10); INSERT INTO ty_test VALUES ('2002/10/15',20); INSERT INTO ty_test VALUES ('2002/11/15',30); DROP VIEW vw_ty_test; CREATE VIEW vw_ty_test AS SELECT TO_CHAR(datein,'MM/YYYY') AS datein2, SUM(money) FROM ty_test GROUP BY datein2; SELECT * FROM ty_test; -- All rows from table. SELECT * FROM vw_ty_test; -- All rows from view. SELECT * FROM vw_ty_test WHERE datein BETWEEN '2002/10/01' AND '2002/10/9'; --==============================