Oliveiros C, wrote:
Hello, Justin, Gary.
 
Justin, your (the second one) query is not much different from mine.
No its not, 
 You previewed  the possibility of having orders without any matching entry on orders_log with your left join, something that I haven't. Gary, will you have
records on your orders table that don't reference any record on your orders_log table? If so, Justin's query is the right one you should use.
 
You return the full record from orders and an additional column from orders_log, the ol_timestamp column. I understood that Gary wanted the full record from orders_log, not
just the timestamp column. That part is done by my subquery .
 
 I think Gary could clarify what he wants exactly. Gary? :)
Yes gary please do if these do not answer your questions???
 
Also, Justin, your query design seems right to me, but maybe you should add this (the part in comment) to your subquery
SELECT MAX(ol_timestamp) /* as ol_timestamp */ , o_id FROM orders_log group by o_id
because the MAX(ol_timestamp) will receive the name max, not ol_timestamp, and probably
the parser will complain that column ol_timestamp  does not exist.
Ain't I right?

Yes you are correct i forgot to add the AS

Reply via email to