Re: [SQL] how to store a query, that results in a table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul Wehr <paul(at)industrialsoftworks(dot)com>
Cc: Keith Wong <keith(at)e-magine(dot)com(dot)au>, Nelson <nbrito(at)cmet(dot)net>, Jie Liang <jliang(at)ipinc(dot)com>, "pgsql-general(at)hub(dot)org" <pgsql-general(at)hub(dot)org>, "pgsql-novice(at)hub(dot)org" <pgsql-novice(at)hub(dot)org>, "pgsql-sql(at)hub(dot)org" <pgsql-sql(at)hub(dot)org>
Subject: Re: [SQL] how to store a query, that results in a table
Date: 2000-09-23 16:20:07
Message-ID: 1668.969726007@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice pgsql-sql

Paul Wehr <paul(at)industrialsoftworks(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2000-09-23 16:45:02 Re: running maintenance tasks on DB
Previous Message Jarmo Paavilainen 2000-09-23 16:13:45 About OID and the commands/operators STRING( ... ) ..AS and +

Browse pgsql-novice by date

  From Date Subject
Next Message Boszormenyi Laszlo 2000-09-23 16:23:37 Case (in)sensitive
Previous Message D. Duccini 2000-09-23 15:11:42 Re: add or subtract days from a 'date' in query

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-09-23 16:46:18 Re: missing "day(s)" in interval (was: Convert from Seconds-Since-Epoch to Timestamp)
Previous Message Louis-David Mitterrand 2000-09-23 15:45:20 missing "day(s)" in interval (was: Convert from Seconds-Since-Epoch to Timestamp)