Re: [SQL] simple (?) join

2009-09-26 Thread justin
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.*,

Re: [SQL] simple (?) join

2009-09-26 Thread David W Noon
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_tim

Re: [SQL] simple (?) join

2009-09-26 Thread justin
David W Noon wrote: A nested query Select orders.*, (SELECT MAX(ol_timestamp) FROM orders_log where orders_log.o_id = orders.oid) >From orders That won't give the desired results. I don't think the SQL parser will even accept it. Yes this is a  valid SQL statemen

Re: [SQL] simple (?) join

2009-09-26 Thread justin
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