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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] how to store a query, that results in a table
Дата
Msg-id 1668.969726007@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [SQL] how to store a query, that results in a table  (Nelson <nbrito@cmet.net>)
Список 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 по дате отправления:

Предыдущее
От: Boszormenyi Laszlo
Дата:
Сообщение: Case (in)sensitive
Следующее
От: Claus Houmøller
Дата:
Сообщение: Re: Case (in)sensitive