Re: [SQL] pass in array to function for use by where clause? how optimize?

2011-04-13 Thread Anish Kejariwal
, Tom Lane wrote: > Rob Sargent writes: > > On 04/13/2011 09:09 AM, Tom Lane wrote: > >> Anish Kejariwal writes: > >>> (select store_id, avg(sales) sales > >>> from store > >>> where group_id in(select $1[i] from generate_subscripts($1, 1) g

[SQL] pass in array to function for use by where clause? how optimize?

2011-04-12 Thread Anish Kejariwal
I have the following query: select seta.store_id, avg(seta.sales) avg_seta, avg(setb.sales) avg_setb from (select store_id, avg(sales) sales from store where group_id in(10,11,12) group by store_id ) seta, (select store_id, avg(sales) sales from store where group_id in(13,14,15) group by