| From: | David W Noon <dwnoon(at)ntlworld(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: simple (?) join |
| Date: | 2009-09-26 19:53:49 |
| Message-ID: | 20090926205349.5fa284f1@dwnoon.ntlworld.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(dot)w(dot)noon(at)ntlworld(dot)com (David W Noon)
=======================================================================
| From | Date | Subject | |
|---|---|---|---|
| Next Message | justin | 2009-09-26 20:15:37 | Re: simple (?) join |
| Previous Message | justin | 2009-09-26 18:54:24 | Re: simple (?) join |