optimization - mySql optimize a query -


I'm looking to get the last 10 places from my database for each driver (authentication_ID). But two different questions have to be written, which use the results area of ​​the past. How can I write it as a single question?

  Certification_ID related to GPS where the GPS_track is from (location_timestamp) = DATE (now () ())  

loop resultset for every $ authID ...

Select Latitude, WHERE authentication_id = ". $ AuthID."

You can enter a query inside a query. It is called ''

example
  select latitude, from GPS_track to WHERE authentication_id (selection difference) Authentication_ID from GPS_track) where date (location_timemstamp) = DATE (now ())) location_stimestamp DESC limit 10 ";  

Performance optimization

Apart from this, your question was also indicated about performance (optimization). If this is a problem, you can put indexes on the columns you try to filter (the columns used in the WHERE statement). There are several ways to optimize your performance; this is a (indexed), and rewriting your questions is the best way to increase performance: more on display:


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -