From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Scott Chapman <scott_list(at)mischko(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org>, Martijn van Oosterhout <kleptog(at)svana(dot)org> |
Subject: | Re: SQL subquery to supply table name? |
Date: | 2002-09-27 05:56:00 |
Message-ID: | 20020926225300.X34750-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 26 Sep 2002, Scott Chapman wrote:
> I was lead to believe that Postgresql would handle this from reading the docs.
> This error message from psql made me think it would also:
>
> select txtcompanyname from (select table_quest from reviews where
> review_num=28) where review_num=28;
>
> ERROR: sub-SELECT in FROM must have an alias
> For example, FROM (SELECT ...) [AS] foo
>
> What is the "sub-SELECT in FROM" supposed to be used for if not this usage?
It's effectively as if you defined a view with that as the definition and
used it. It mostly exists to allow multiple levels of processing (for
example, you want to do a query that does something to a set of grouped
data).
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Kovacs | 2002-09-27 06:52:29 | Re: [JDBC] Prepared statement performance... |
Previous Message | Yury Bokhoncovich | 2002-09-27 05:14:40 | Re: [HACKERS] Performance while loading data and indexing |