David W Noon wrote:
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 ... ]
  

Guessing here

 Answer to return the last time someone either viewed or edited the order.

This is a very common audit requirement to track who what, when and why something happened. 

Reply via email to