Re: simple (?) join - Mailing list pgsql-sql

From David W Noon
Subject Re: simple (?) join
Date
Msg-id 20090926205349.5fa284f1@dwnoon.ntlworld.com
Whole thread Raw
In response to Re: simple (?) join  (justin <justin@emproshunts.com>)
Responses Re: simple (?) join  (justin <justin@emproshunts.com>)
List 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 by date:

Previous
From: justin
Date:
Subject: Re: simple (?) join
Next
From: justin
Date:
Subject: Re: simple (?) join