Guest User

Untitled

a guest
Jun 21st, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. select recipes.*, count(*) FROM recipes LEFT JOIN (SELECT recipe_id FROM votes WHERE vote AND created_at >= '2009-06-14 00:00:00' UNION ALL SELECT recipe_id FROM recipe_views WHERE created_at >= '2009-06-14 00:00:00') AS r1 ON r1.recipe_id = recipes.id GROUP BY recipes.id ORDER BY count(*) DESC, recipes.created_at DESC
Add Comment
Please, Sign In to add comment