Re: sub-select with aggregate

From: "Tomasz Myrta" <jasiek(at)klaster(dot)net>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>, Tomasz Myrta <jasiek(at)klaster(dot)net>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: sub-select with aggregate
Date: 2002-10-23 23:19:51
Message-ID: 20021024081951.M77126@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)klaster(dot)net>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message patrick 2002-10-24 02:44:14 sub-select trouble: wrong SQL or PostgreSQL issue?
Previous Message Josh Berkus 2002-10-23 21:15:31 Re: Sum of Every Column