VIEW's on UNION's

Поиск
Список
Период
Сортировка
От Kaare Rasmussen
Тема VIEW's on UNION's
Дата
Msg-id 199901150743.IAA08639@bohr.webline.dk
обсуждение исходный текст
Ответ на Re: [GENERAL] two questions  (Tim Williams <williams@ugsolutions.com>)
Список pgsql-general
I miss <subject>. I know the answer is that I can write them myself,
but I don't know where to start or end.

See this construct:
CREATE TABLE gl-amount (
    glam_nr int,
    period date,
    entry_amount numeric(9,0),
    PRIMARY KEY (glam_seq,period)
    );

CREATE VIEW glam_curmth_v AS
    SELECT entry_amount AS amount1 FROM gl-amount
    WHERE date_part(year', period) = date_part('year', now::datetime)
    AND date_part('month', period) = 1
    UNION SELECT entry_amount AS amount2 FROM gl-amount
    WHERE type = 'S' AND  period = 2;

   SELECT entry_amount AS amount1 FROM gl-amount
    WHERE date_part('year', period) = date_part('year', 'now'::datetime)
    AND date_part('month', period) = 1
    UNION SELECT entry_amount AS amount2 FROM gl-amount
    WHERE date_part('year', period) = date_part('year', 'now'::datetime)
    AND date_part('month', period) = 2
    ...

Can it be done without the use of VIEW's on UNION's?


В списке pgsql-general по дате отправления:

Предыдущее
От: Oleg Broytmann
Дата:
Сообщение: Re: [GENERAL] How to display stored image on web page?
Следующее
От: Memphisto
Дата:
Сообщение: Representation of big integer numbers.