lib/dataset/query.js
function (columns) {
            columns = argsToArray(arguments);
            var group = this.group.apply(this, columns.map(function (c) {
                return this._unaliasedIdentifier(c);
            }, this));
            return group.select.apply(group, columns.concat([this._static.COUNT_OF_ALL_AS_COUNT]));

        }
function (columns) {
            columns = argsToArray(arguments);
            var group = this.group.apply(this, columns.map(function (c) {
                return this._unaliasedIdentifier(c);
            }, this));
            return group.select.apply(group, columns.concat([this._static.COUNT_OF_ALL_AS_COUNT]));

        }
function ( columns ) { columns = argsToArray ( arguments ) ; var group = this . group . apply ( this , columns . map ( function ( c ) { return this . _unaliasedIdentifier ( c ) ; } , this ) ) ; return group . select . apply ( group , columns . concat ( [ this . _static . COUNT_OF_ALL_AS_COUNT ] ) ) ; }
Returns a dataset grouped by the given column with count by group.
Column aliases may be supplied, and will be included in the select clause.

@example

DB.from("items").groupAndCount("name").all()
//=> SELECT name, count(*) AS count FROM items GROUP BY name
//=> [{name : 'a', count : 1}, ...]

DB.from("items").groupAndCount("first_name", "last_name").all()
//SELECT first_name, last_name, count(*) AS count FROM items GROUP BY first_name, last_name
//=> [{first_name : 'a', last_name : 'b', count : 1}, ...]

DB.from("items").groupAndCount("first_name___name").all()
//=> SELECT first_name AS name, count(*) AS count FROM items GROUP BY first_name
//=> [{name : 'a', count:1}, ...]
@param {String...|patio.sql.Identifier...} columns columns to croup and count on.

@return {patio.Dataset} a cloned dataset with the GROUP clause and count added.
Returns a dataset grouped by the given column with count by group . Column aliases may be supplied and will be included in the select clause .