pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Terry Yapt <yapt@technovell.com>
To: pgsql-sql@postgresql.org
Subject: Restricting a VIEW.
Date: Sun, 20 Oct 2002 03:13:14 +0200
Message-ID: <3DB2032A.496345A1@technovell.com> (raw)

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';
--==============================



view thread (4+ messages)  latest in thread

Message-ID: <3DB2032A.496345A1@technovell.com>
Permalink:  ../3DB2032A.496345A1@technovell.com/
Also on:    postgresql.org/message-id/3DB2032A.496345A1@technovell.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: yapt@technovell.com
  Subject: Re: Restricting a VIEW.
  In-Reply-To: <3DB2032A.496345A1@technovell.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox