Re: simple (?) join

Поиск
Список
Период
Сортировка
От David W Noon
Тема Re: simple (?) join
Дата
Msg-id 20090926205349.5fa284f1@dwnoon.ntlworld.com
обсуждение исходный текст
Ответ на Re: simple (?) join  (justin <justin@emproshunts.com>)
Ответы Re: simple (?) join  (justin <justin@emproshunts.com>)
Список pgsql-sql
On Sat, 26 Sep 2009 14:54:24 -0400, justin wrote about Re: [SQL] simple
(?) join:

[snip]
>Quoting Gary
>"How can I select all from orders and the last (latest) entry from the 
>orders_log?"

In that case, a simple Cartesian product will do:

SELECT o.*, maxi.ts
FROM orders AS o,
(SELECT MAX(ol_timestamp) AS ts FROM orders_log) AS maxi;

Since the cardinality of the subquery "maxi" is 1, it will give a result
set with cardinality of the complete orders table.

I don't understand why anybody would want to do that. [De gustibus ... ]
-- 
Regards,

Dave  [RLU #314465]
=======================================================================
david.w.noon@ntlworld.com (David W Noon)
=======================================================================


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

Предыдущее
От: justin
Дата:
Сообщение: Re: simple (?) join
Следующее
От: justin
Дата:
Сообщение: Re: simple (?) join