sequelize/sequelize — pull request #907 by iamjochem (2013-09-16 14:17:31+00:00)
Title: Bugfix/group count hack

make Model.count a little smarter with regard to counts where there is with a `group` clause - `COUNT(*)` in combination with a `GROUP BY` will return a count of all the matches records prior to grouping, I'd very much prefer to a get a total count of the number of actually returned records (i.e. a total of the number of grouped records)

this commit makes Model.count() a little smarter in that it will automatically generate something like `COUNT(DISTINCT my_grouping_fld)` instead of `COUNT(*)` if it finds a `group` attribute in the passed in `options` object, e.g. like so:

```js
Model.count({where: {some_fld: true}, group: 'my_grouping_fld'});
```