| From: | justin <justin(at)emproshunts(dot)com> |
|---|---|
| To: | David W Noon <dwnoon(at)ntlworld(dot)com>, pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: simple (?) join |
| Date: | 2009-09-26 20:15:37 |
| Message-ID: | 4ABE7669.50001@emproshunts.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
David W Noon wrote:
<blockquote cite="mid:20090926205349(dot)5fa284f1(at)dwnoon(dot)ntlworld(dot)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 audit requirement to track who what, when and why
something happened. <br>
</body>
</html>
| Attachment | Content-Type | Size |
|---|---|---|
| unknown_filename | text/html | 1.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gary Stainburn | 2009-09-28 11:02:20 | Re: simple (?) join |
| Previous Message | David W Noon | 2009-09-26 19:53:49 | Re: simple (?) join |