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.

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to