Re: sub-select with aggregate - Mailing list pgsql-sql

From Tomasz Myrta
Subject Re: sub-select with aggregate
Date
Msg-id 20021024081951.M77126@klaster.net
Whole thread Raw
In response to Re: sub-select with aggregate  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-sql
> 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 <jasiek@klaster.net>



pgsql-sql by date:

Previous
From: Ludwig Lim
Date:
Subject: Simulating a SELECT..FOR UPDATE to LOCK and SELECT statement
Next
From: Achilleus Mantzios
Date:
Subject: Re: Sum of Every Column