Anatoliy_Gerasimov

Untitled

Dec 27th, 2020
940
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2. IF ( id_user IS NULL, 'Visitor', 'User' ) AS user_type,
  3. flag_converted,
  4. IF ( rating=5, 1, 0) AS is_best_rating,
  5. COUNT(*) as count
  6.  
  7. FROM `files`
  8. GROUP BY user_type, flag_converted, is_best_rating
  9. HAVING count > 1
  10. ORDER BY count DESC, is_best_rating DESC
  11.  
RAW Paste Data