Re: Full outer join? Cross product? How to blend two queries into single row?

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: Full outer join? Cross product? How to blend two queries into single row?
Дата
Msg-id 20080904220618.GW7271@frubble.xen.chris-lamb.co.uk
обсуждение исходный текст
Ответ на Re: Full outer join? Cross product? How to blend two queries into single row?  ("Richard Broersma" <richard.broersma@gmail.com>)
Список pgsql-general
On Thu, Sep 04, 2008 at 02:58:39PM -0700, Richard Broersma wrote:
> On Thu, Sep 4, 2008 at 2:54 PM, Sam Mason <sam@samason.me.uk> wrote:
> >  SELECT * FROM foo FULL OUTER CROSS JOIN bar;
> >
> > Admittedly, there aren't too many use cases for this!  But it would make
> > things a bit more regular.
>
>  SELECT * FROM foo, bar;
>
> Isn't this have the same results, but with out the cross join?

I hope not!  Try running:

  SELECT * FROM
    (SELECT 1 AS a WHERE FALSE) f,
    (SELECT 2 AS b            ) b;

and then try:

  SELECT * FROM
    (SELECT 1 AS a WHERE FALSE) f FULL OUTER JOIN
    (SELECT 2 AS b            ) b ON TRUE;

I hope you get zero rows back from the first query, and a single row
back from the second with a NULL value in the "a" column.


  Sam

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

Предыдущее
От: "Richard Broersma"
Дата:
Сообщение: Re: Full outer join? Cross product? How to blend two queries into single row?
Следующее
От: "Akhtar Yasmin-B05532"
Дата:
Сообщение: Re: Postgres does not start, gives no error