Guest User

Untitled

a guest
Jun 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. ActiveRecord::StatementInvalid (PGError: ERROR: column "recipes.name" must appear in the GROUP BY clause or be used in an aggregate function
  2. : SELECT recipes.*, sum(c) AS net_votes_and_views FROM "recipes" LEFT JOIN (SELECT
  3. recipe_id,
  4. CASE vote WHEN true THEN 1 ELSE -1 END AS c
  5. FROM
  6. votes
  7. WHERE
  8. vote IS NOT NULL
  9. AND
  10. created_at >= '2009-06-13 11:52:45'
  11. UNION ALL
  12. SELECT
  13. recipe_id,
  14. 1 AS c
  15. FROM
  16. recipe_views
  17. WHERE
  18. created_at >= '2009-06-13 11:52:45') AS l1 ON l1.recipe_id = recipes.id WHERE (("recipes"."active" = 't')) GROUP BY recipes.id ORDER BY net_votes_and_views DESC, recipes.created_at DESC LIMIT 5 OFFSET 0):
Add Comment
Please, Sign In to add comment