Greg Stark <[EMAIL PROTECTED]> writes:
> What would be useful is something like

> SELECT item_id, 
>        first(price) as min_price, first(store_id) as min_store,
>        avg(price) as avg_price,
>        last(price) as max_price,  last(store_id) as min_store,
>        count(distinct store_id) as num_stores
>  FROM (SELECT * FROM items_for_sale ORDER BY item_id, store_id)
> GROUP BY store_id

Write it yourself --- both first() and last() are trivial to code as
user-defined aggregates.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

Reply via email to