Ruby on Rails Wednesday, March 2, 2011

Here is a simple request:

Visit.group("user_id")

And I get:

PGError: ERROR: column "visits.id" must appear in the GROUP BY clause
or be used in an aggregate function

If I add visits.id to the group by clause, then it asks me to add
another column, then another, then another. Basically I have to list all
columns in the table!

What's going wrong? From the Rails guide it seemed straightforward.


Thanks for your help

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment