title: MySQL rand() ignore duplicates
body: <p>I have been trying to use the following MySQL:</p>
  
  <pre><code>  SELECT distinct(photos.id)
         , photos.file
         , photos.tags
         , photos.desc
         , photos.ratio
         , tags.bid
         , tags.tagname_id 
      FROM photos
         , tags 
     WHERE photos.trending=1 
       AND tags.pid=photos.id
  ORDER BY RAND() 
     LIMIT 10
  </code></pre>
  
  <p>I tried using <code>DISTINCT</code> to prevent duplicate entries but it doesn't seem to be working in my situation.</p>
  
  <p>What is the best way to get this to work?</p>