SHARE
TWEET

Untitled

a guest Mar 20th, 2017 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT random_book.*
  2. FROM book
  3. LEFT JOIN (SELECT * FROM book ORDER BY RAND()) random_book ON (book.lang = random_book.lang)
  4. GROUP BY random_book.lang
  5.    
  6. SELECT * FROM book WHERE lang=1 ORDER BY RAND() LIMIT 1
  7. UNION
  8. SELECT * FROM book WHERE lang=2 ORDER BY RAND() LIMIT 1
  9. UNION
  10. SELECT * FROM book WHERE lang=3 ORDER BY RAND() LIMIT 1
RAW Paste Data
Top