mysql - How to make this query more efficient? -


a comment my previous question said "i suggest looking @ answers here well: stackoverflow.com/questions/1313120/…. answer accepted thought technically correct, in practice might turn out inefficient, since mysql not correlated subqueries".

the sql of answer accepted at sql fiddle. referenced question compares left join , inner join. sql fddle uses join< understand default inner join.

so, how can rewrite query use lft join?

i'm not of performance on mysql, can left join rows disqualify position, , use select records left join didn't match.

select v.id      , v.description      , v.type      , p.time_stamp      , p.latitude      , p.longitude   positions p   join vehicles v on v.id = p.id   left join positions l on l.id = p.id                          , l.time_stamp > p.time_stamp   l.id null 

or, in sqlfiddle: http://sqlfiddle.com/#!2/2e994/31/0


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -