title: Every derived table must have its own alias
body: <p>I have the following query:</p>
  
  <pre><code>SELECT `snap`.`ID`, `user`.`username`, `vote`.`type` 
  FROM (`snap`) JOIN `user` as u ON `u`.`ID` = `snap`.`user` 
  LEFT JOIN (select * from vote where user = "18") as vote ON `snap`.`ID` = `vote`.`snap` 
  JOIN (SELECT CEIL(MAX(ID)*RAND()) AS ID FROM snap)) AS x ON `snap`.`ID` =&gt; `x`.`ID` 
  WHERE `snap`.`active` = 0 LIMIT 1
  </code></pre>
  
  <p>It worked just fine untill I added the last JOIN. Now i get the error: "Every derived table must have its own alias". I know it is because every table needs its on alias and I need to put "as S" or something somewhere, but I can't find out how to do that in this query.</p>