title: mysql RAND() LIMIT
body: <p>Hello I have a query like this:</p>
  
  <pre><code>    SELECT otel_id 
          FROM YAZILIM_menu_icerik 
          WHERE YAZILIM_menu_icerik.menu_id = 39 
          AND otel_id IN (
                          SELECT otel_id 
                          FROM YAZILIM_menu_icerik 
                          WHERE menu_id =$id 
                          ORDER BY RAND()
                          ) 
          LIMIT 0,20
  </code></pre>
  
  <p>It should display randomly 20 hotels each time it works but instead , i'm ending up getting the same 20 hotel each time. Long story short <code>RAND()</code> doesn't seem to work and I can't seem to find any logical error. </p>
  
  <p>EDIT: Problem solved. Mysql doesn't see inner RAND() so here's the correct way to do it:</p>
  
  <pre><code>SELECT otel_id 
      FROM YAZILIM_menu_icerik 
      WHERE YAZILIM_menu_icerik.menu_id = 39 
      AND otel_id IN (
                      SELECT otel_id 
                      FROM YAZILIM_menu_icerik 
                      WHERE menu_id =$id 
                     )
  ORDER BY RAND() 
  LIMIT 0,20
  </code></pre>