New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow join conditions to use an object. #743

whitelynx opened this Issue Mar 19, 2015 · 3 comments


None yet
3 participants

whitelynx commented Mar 19, 2015

Currently, join conditions may be specified in 3 ways:

knex.from('users').innerJoin('accounts', '', 'accounts.user_id')

knex.table('users').innerJoin('accounts', '', '=', 'accounts.user_id')

knex('users').innerJoin('accounts', function() {
  this.on('', '=', 'users.account_id').orOn('accounts.owner_id', '=', '')

However, those familiar with .where() would expect a 4th possibility:

knex('users').innerJoin('accounts', {
  '': 'users.account_id',
  'accounts.owner_id': ''

Could this syntax be added?


This comment has been minimized.


bendrucker commented Mar 19, 2015

For sure. We'll definitely take a PR.


This comment has been minimized.


tgriesser commented Mar 25, 2015

Wow that's such an obvious/better syntax. I'll definitely throw it on the list.


This comment has been minimized.


tgriesser commented Apr 30, 2015

Available in 0.8

@tgriesser tgriesser closed this Apr 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment