Re: Parameterized views proposition

Поиск
Список
Период
Сортировка
От Tambet Matiisen
Тема Re: Parameterized views proposition
Дата
Msg-id A66A11DBF5525341AEF6B8DE39CDE77008804F@black.aprote.com
обсуждение исходный текст
Ответ на Parameterized views proposition  ("Tambet Matiisen" <t.matiisen@aprote.ee>)
Список pgsql-sql
>
> > Especially if you would like to put a filter on right side of left
> > join. Consider this query:
> >
> > select p.product_id, coalesce(sum(s.amount), 0)
> > from product p
> > left join sales s on p.product_id = s.product_id and s.date between
> > '2005-01-01' and '2005-01-31' group by p.product_id
> >
> > We would like to have all products listed with sum of their
> sales or 0
> > if there wasn't any. I haven't figured out so far, how to
> write this
> > query as view, so that I can set different filters at client side.
>
> You need to expose the columns you want to filter on so that
> they can be used in WHERE clauses.
>

Exposing columns won't solve my problem. See the previous query -
sales.date ise grouped out and can't be exposed (note that I want all
products listed, regardless if there were sales in this period or not).
 Tambet


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Parameterized views proposition
Следующее
От: Andrew - Supernews
Дата:
Сообщение: Re: Parameterized views proposition