Re: simple (?) join

Поиск
Список
Период
Сортировка
От justin
Тема Re: simple (?) join
Дата
Msg-id 4ABE7669.50001@emproshunts.com
обсуждение исходный текст
Ответ на Re: simple (?) join  (David W Noon <dwnoon@ntlworld.com>)
Ответы Re: simple (?) join  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список pgsql-sql
David W Noon wrote: <blockquote cite="mid:20090926205349.5fa284f1@dwnoon.ntlworld.com" type="cite"><pre wrap="">On
Sat,26 Sep 2009 14:54:24 -0400, justin wrote about Re: [SQL] simple
 
(?) join:

[snip] </pre><blockquote type="cite"><pre wrap="">Quoting Gary
"How can I select all from orders and the last (latest) entry from the 
orders_log?"   </pre></blockquote><pre wrap="">
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 ... ] </pre></blockquote><br /> Guessing here <br
/><br/>  Answer to return the last time someone either viewed or edited the order.<br /><br /> This is a very common
auditrequirement to track who what, when and why something happened.  <br /> 

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

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