Re: [SQL] how to store a query, that results in a table - Mailing list pgsql-novice

From Tom Lane
Subject Re: [SQL] how to store a query, that results in a table
Date
Msg-id 1668.969726007@sss.pgh.pa.us
Whole thread Raw
In response to [SQL] how to store a query, that results in a table  (Nelson <nbrito@cmet.net>)
List pgsql-novice
Paul Wehr <paul@industrialsoftworks.com> writes:
> create view complex_view as select blah, ..... , effective_date.date
> from tablea, tableb, tablec, effective_date
> where tablea.foo=tableb.foo
>    ....
>   and effective_date.date between tablec.start_date=tablec.end_date
> ;

> insert into effective_date values ('09/23/2000');  -- may "fail" if date is
> already in the table, but if it is, who cares?

> select *
> from complex_view
> where date='09/23/2000';

Er, why don't you just do

select * from complex_view
where '09/23/2000' between start_date and end_date;

I don't see what the effective_date table is buying ...

            regards, tom lane

pgsql-novice by date:

Previous
From: Boszormenyi Laszlo
Date:
Subject: Case (in)sensitive
Next
From: Claus Houmøller
Date:
Subject: Re: Case (in)sensitive