Search code examples
javaandroidsqlandroid-cursorloader

CursorLoader - order by in SQL is case insensitive


I am trying to query information with a CursorLoader from my SQL database. How do I make the order case insensitive?

return new CursorLoader(this, CONTENT_URI, projection, null, null, orderBy);

Solution

  • I'm using this question/answers as source:

    While ordering, you can "convert" the data to lower/upper case. Data retrieved won't be affected since you are changing the ORDER BY statement.

    return new CursorLoader(this, CONTENT_URI, projection, null, null, "UPPER(COLUMN_NAME)");