View Single Post
  #2 (permalink)  
Old 07-09-2008, 04:32 AM
Unregistered
 
Posts: n/a
Default ANY answer. Re: select values from the 2 different table

[sql]select Companies.id, Locations.location, revision
from Companies inner join Locations on Companies.id=Locations.id
inner join
(select C1.id, max(C2.revision) as maxrevision
from Companies C1 inner join Locations C2 on C1.id=C2.id group by C1.id) T2
on Companies.id=T2.id and revision=maxrevision
[/sql]
I do this...it works, but if i just want to output the first 2 column, how?
Companies.id, Locations.location only..i only can do if revision is output together with it,.

Please help. thanks.
Reply With Quote