Skip to content

Commit f7bc7ce

Browse files
committed
Merge pull request sequelize#2079 from TheBenji/1.7.0
distinct option for count
2 parents f793b95 + 7e58bf9 commit f7bc7ce

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/dao-factory.js

+6
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,12 @@ module.exports = (function() {
614614
[this.sequelize.fn('COUNT', col), 'count']
615615
]
616616

617+
if(options.distinct) {
618+
options.attributes = [
619+
[this.sequelize.fn('COUNT', this.sequelize.fn('DISTINCT', col) ), 'count']
620+
]
621+
}
622+
617623
options.includeIgnoreAttributes = false
618624
options.limit = null
619625

0 commit comments

Comments
 (0)