I have a database table with two columns updated_at
and children_updated_at
and I would like to show the latest modified records first based on the SQL function GREATEST(updated_at, children_updated_at)
.
The SQL query I’d like to generate is:
select * from Account ORDER BY GREATEST(updated_at, children_updated_at);
I could not find anything about using GREATEST()
or other SQL functions that combine columns in the Prisma documentation.
The actual query is a lot more complex, and because of that a raw sql query will not work for me.
Is there a way to achieve this requirement using Prisma ORM?