This project is archived and is in readonly mode.

#5721 ✓resolved
Julien Portalier

count with group by discards :distinct option

Reported by Julien Portalier | September 28th, 2010 @ 10:10 AM | in 3.0.2

A simple count does generate the correct SQL :

Post.count(:user_id, :distinct => true)
# SELECT COUNT(DISTINCT "posts"."user_id") AS "count_user_id" FROM "posts"

But mixing group and count discards the :distinct option:, :distinct => true)
# SELECT COUNT("posts"."user_id") AS "count_user_id", date AS date
# FROM "posts" GROUP BY date

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>


Referenced by