Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2BF34475C2B for ; Thu, 24 Oct 2002 02:26:33 -0400 (EDT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 9088F475AA1 for ; Thu, 24 Oct 2002 02:26:32 -0400 (EDT) Received: from lamer.pl (localhost [127.0.0.1]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 6DB062B4D6; Thu, 24 Oct 2002 08:19:51 +0200 (CEST) From: "Tomasz Myrta" To: Stephan Szabo , Tomasz Myrta Cc: Subject: Re: sub-select with aggregate Date: Thu, 24 Oct 2002 08:19:51 +0900 Message-Id: <20021024081951.M77126@klaster.net> In-Reply-To: <20021023082355.G5481-100000@megazone23.bigpanda.com> References: <20021023081036.M5349-100000@megazone23.bigpanda.com> <20021023082355.G5481-100000@megazone23.bigpanda.com> X-Mailer: Open WebMail 1.62 20020221 X-OriginatingIP: 217.96.97.138 (jasiek) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/321 X-Sequence-Number: 10038 > The other forms only move the filtering clauses around. There's > still only a filter on the outer group_id equaling the inner > group_id and a filter on group_id=3. It's just a question of > whether it's: > > Scan users in subselect from group_id=3, group and aggregate them > and join with users on subselect's group_id = users.group_id > > or > > Scan users for group_id=3, scan users in subselect, group and > aggregate them and join these two on subselect's > group_id=users.group_id. > > The latter is effectively what your original query gave, the former > appears to be what my two queries from a couple of mails ago gives. I'm sorry, if you misunderstood me - I didn't show it clear. I want to scan users for group_id=3 and then join subselect for the same group_id. I can't pass group_id=3 directly to subselect, because it's not a query but a view. -- Tomasz Myrta