Skip to content
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

Combining .min() and .max() with .column() does not provide valid SQL (missing comma) #144

chimmelb opened this issue Jan 2, 2014 · 1 comment


Copy link

@chimmelb chimmelb commented Jan 2, 2014

This is connecting to a mySQL database.
Knex package 0.5.2

      .column(['id', 'other' ])
      .select().exec( callback );

When using .column() with the .min()/.max() methods, a comma after the columns is not inserted. Order in the builder does not make a difference. Error message is like this (edited for the example):

  "message": "ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'min(`lowScore`), max('highScore') at line 1, sql: select `id`, `other` min(`lowScore`), max(`highScore`) from `table` inner join `othertable` on `` = `` where              `other` = ? and `C8018_Deleted_Flag` = ?, bindings: 1,0"

In the SQL statement, there is no comma between 'other' and min().

Copy link

@tgriesser tgriesser commented Jan 2, 2014

Thanks for the issue @chimmelb! Fixed by @johanneslumpe in #145 and pushed out in 0.5.3, let me know if there's any other issues you come across!

@tgriesser tgriesser closed this Jan 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants