From: | "Tambet Matiisen" <t(dot)matiisen(at)aprote(dot)ee> |
---|---|
To: | "Bruno Wolff III" <bruno(at)wolff(dot)to> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Parameterized views proposition |
Date: | 2005-03-12 18:00:48 |
Message-ID: | A66A11DBF5525341AEF6B8DE39CDE77008804F@black.aprote.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew - Supernews | 2005-03-12 19:18:25 | Re: Parameterized views proposition |
Previous Message | Bruno Wolff III | 2005-03-12 16:34:57 | Re: Parameterized views proposition |