> I am not sure if this could apply to your case, but maybe - unless you have >done it before - > > you could look at windowing functions Ciao Gabriele, the problem is that the only thing the N queries have in common is the base table; everything else is different, because the different "group by"s aren't related one to another. My understanding is that windowing functions can't help in that case, but I'll look at them Thank you Leonardo -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general