Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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