Espeto
Espeto

Reputation: 23

Order by FIELD() for mysql in prisma

I need the output to be ordered in the same order as the parameters, in a query MySql it would look like this

SELECT * FROM your_table
WHERE id IN (5,2,6,8,12,1)
ORDER BY FIELD(id,5,2,6,8,12,1);

How can I do it using the prism?

Upvotes: 1

Views: 195

Answers (1)

Nurul Sundarani
Nurul Sundarani

Reputation: 7568

You would need to use Raw Query to achieve this, Order By FIELD() is not natively supported yet.

Here's a Feature Request for adding support for Order By Field: #9708

Upvotes: 1

Related Questions