Re: JOINing subselects in FROM?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: JOINing subselects in FROM?
Дата
Msg-id 5280.1018450928@sss.pgh.pa.us
обсуждение исходный текст
Ответ на JOINing subselects in FROM?  (Alvaro Herrera <alvherre@atentus.com>)
Список pgsql-general
Alvaro Herrera <alvherre@atentus.com> writes:
> I'm trying to JOIN two subselects-in-from clauses and can't get it
> right:

> SELECT foo1.mes, valor1999 AS "1999", valor2000 AS "2000" FROM
>     (SELECT valor AS valor1999, mes FROM datos WHERE a�o=1999) AS foo1
>     OUTER JOIN
>         (SELECT valor AS valor2000, mes FROM datos WHERE a�o=2000) AS foo2
>     ON foo1.mes=foo2.mes;
> ERROR:  parser: parse error at or near "OUTER"

Should be LEFT JOIN or LEFT OUTER JOIN.

> If I try to do an INNER JOIN, I get instead
> SELECT foo1.mes, valor1999 AS "1999", valor2000 AS "2000" FROM
>     (SELECT valor AS valor1999, mes FROM datos WHERE a�o=1999) AS foo1
>     INNER JOIN
>         (SELECT valor AS valor2000, mes FROM datos WHERE a�o=2000) AS foo2
>     ON foo1.mes=foo2.mes;
> ERROR:  flatten_join_alias_var: unexpected subtree type

[ scratches head ... ]  I do not get that.  I think there must be
something broken about your build; or perhaps there's a portability
problem lurking in devel sources.  Would you try a full rebuild (make
distclean, configure, build, initdb) to eliminate the possibility of
internal version mismatches?

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Justin Clift
Дата:
Сообщение: [Fwd: AW: More UB-Tree patent information]
Следующее
От: Joe Conway
Дата:
Сообщение: Re: Postgresql 7.2