Menu

#45 Showing counts for distinct results

open
nobody
3
2012-10-24
2002-07-19
No

When enlisting a distinct result set, it would be useful to
somehow get the information how many objects are
having each value, e.g. by putting the number in
parentheses behind the value itself.

If the query is:
SELECT DISTINCT column1, column2 FROM table
WHERE someClause;

and one result is:
value1, value2

the number should be:
SELECT count(*) FROM table WHERE someClause
AND (column1 = value1) AND (column2 = value2);

Discussion


Log in to post a comment.

MongoDB Logo MongoDB