is it possible to order a column how I want it?
For example, I have a table with a column that has values A,B,C,D
when I query that table, I want to sort the results by D,B,A,C
2 Replies
found the answer. I have to use prisma raw query and have to use order by "case" to have the results sorted the way I want it.
so something like
ORDER BY
CASE
WHEN at.status = 'D' THEN 1
WHEN at.status = 'B' THEN 2
ELSE 3
END,
Hi @zenakent 👋
Prisma doesn't support custom sorting orders directly in its query syntax. You can use raw SQL with a CASE statement. For example: