0
Answered

Order by case-insensitive collation

Alex Waugh 8 months ago • updated by Michał Kołodziejski 8 months ago 1

Is there a way to perform a case-insensitive 'order by' operation when sorting by a text field?

It seems the default is that uppercase records appear above lowercase.
If not, it might be a nice idea.

Thanks.

GOOD, I'M SATISFIED

Thanks!

Satisfaction mark by Alex Waugh 8 months ago
Answered

I think you can do this. In pure SQL it would look like this:

select * from some_table order by lower(some_column);


In order to achieve this, you can do something like:

selectQuery.orderBy(AExp.fun("lower", SomeTableDAO.SOME_COLUMN));

Does it make sense?