Skip to content

Instantly share code, notes, and snippets.

T http91

Block or report user

Report or block http91

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@http91
http91 / count.js
Created Feb 8, 2016 — forked from jordansexton/count.js
Bookshelf.js/Knex.js innerJoin withRelated
View count.js
var Promise = require('bluebird'),
User = require('./user'),
knex, query;
knex = User.prototype._builder(User.prototype.tableName);
query = function (q) {
q.distinct()
.innerJoin('orders', function () {
this.on('users.id', '=', 'orders.user_id')
You can’t perform that action at this time.