Re: [SQL] simple (?) join

2009-09-28 Thread Gary Stainburn
On Monday 28 September 2009 13:30:32 you wrote: > SELECT o.*, ol.* > FROM orders o >LEFT JOIN ( > SELECT ol.o_id, MAX(ol_timestamp) AS maxts >FROM orders_log ol > GROUP BY 1 > ) max_olt > ON max_olt.o_id=o.o_id >LEFT JOIN orders

Re: [SQL] simple (?) join

2009-09-28 Thread David W Noon
On Mon, 28 Sep 2009 12:02:20 +0100, Gary Stainburn wrote about Re: [SQL] simple (?) join: [snip] >For some reason the reply I sent on Friday didn't get through. >What I need is all of the order record and all of the latest log entry >returning as a join. Specifically I want for each order the mos

Re: [SQL] simple (?) join

2009-09-28 Thread Oliveiros C,
Hello, Gary. thank you for your e-mail This is a slightly modified version of the query I sent you on first place (have you tried it out?). It will return (I hope :) the full orders record plus the maximum ol_timestamp and respective o_user. HTH Best, Oliveiros SELECT subquery.*, orders

Re: [SQL] simple (?) join

2009-09-28 Thread Gary Stainburn
On Saturday 26 September 2009 21:15:37 justin wrote: > 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