update group by clause for heroku