title: How can I speed up this query?
body: <p>I have code to generate four cars from a DB with their photos:</p>
  
  <pre><code>$l=$database-&gt;query("SELECT car,brand,exactprice FROM $table ORDER BY rand() LIMIT 4");
  $buffer="";
  foreach($l as $l){
      $buffer.="&lt;li&gt;&lt;h3&gt;{$l['car']}&lt;/h3&gt;&lt;p&gt;Price {$l['exactprice']}&lt;/p&gt;";
      $k=$database-&gt;query("SELECT logo FROM logo WHERE brand='{$l['brand']}'");
      $buffer.="&lt;img src='{$base_addr}/{$k[0]['logo']}'&gt;&lt;br&gt;";
  }
  </code></pre>
  
  <p>That's my current code. Can I rewrite my MySQL command so I would get <code>logo</code> from the <code>logo</code> with the first select I did?</p>
  
  <p>Currently it takes 4.32 seconds to load this page.</p>