Skip to content

How to do case-insensitive sort? #2541

Closed Answered by Jim-salies
sebpowell asked this question in Q&A
Discussion options

You must be logged in to vote

asc and desc functions types show that sql function is accepted so this should do the job :

await db.query.shops.findMany({
  orderBy: asc(sql`lower(${shops.name})`)
});

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@theotherdefranco
Comment options

@sebpowell
Comment options

Answer selected by sebpowell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants