I have this statement running Ok in my development mode
@users = User.paginate :joins => :properties ,:group =>
‘users.id’, :page => params[:page], :order => ‘count(properties.id)
DESC’,:conditions => [‘users.id != 1’]
when I push my app to Heroku it gives me this error
column “users.email” must appear in the GROUP BY clause or be used in
an aggregate function
: SELECT “users”.* FROM “users” INNER JOIN “properties” ON
properties.user_id = users.id WHERE (users.id != 1) GROUP BY
users.id,users.login,users.name ORDER BY count(properties.id) DESC
LIMIT 10 OFFSET 0):
by doing some research on Google, I found out that it’s a DB Engin
problem. MySql allows me to do it but PostgreSql does not.
How can I run the same query on PostgreSql. I am trying to get the
users ordered by the users with highest properties.