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

Bug/improvement: Null last with varchar #1809

Open
royduin opened this issue Aug 1, 2018 · 2 comments
Open

Bug/improvement: Null last with varchar #1809

royduin opened this issue Aug 1, 2018 · 2 comments

Comments

@royduin
Copy link
Contributor

royduin commented Aug 1, 2018

For MySQL nulls_last_sql should be set to -%s %s according the docs, but that only works with numeric values. I'd like to use the solution for varchar values: ISNULL(field), field ASC but that requires the column name 2 times which isn't possible with sprintf(); ISNULL(%s), %s %s. It results in: sprintf(): Too few arguments

@yajra
Copy link
Owner

yajra commented Aug 3, 2018

Thanks for reporting. Does it really need a two column? It seems to work too with SELECT * FROM table ORDER BY ISNULL(field) ASC;

@royduin
Copy link
Contributor Author

royduin commented Aug 4, 2018

With that query it's only sorted on null / not-null, but the not-null result are not sorted ascending or descending.

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

No branches or pull requests

2 participants