Is there any way I could re-write this SQL query using Prisma Client.
SELECT TOP 1 * FROM [myTable]
WHERE Name = 'Test' and Size = 2 and PType = 'p'
ORDER BY ABS( Area - @input )
Is there any way I could re-write this SQL query using Prisma Client.
SELECT TOP 1 * FROM [myTable]
WHERE Name = 'Test' and Size = 2 and PType = 'p'
ORDER BY ABS( Area - @input )
You can use queryRaw and directly pass the raw SQL to execute it.
It would look like this:
const result = await prisma.$queryRaw`SELECT TOP 1 * FROM [myTable]
WHERE Name = 'Test' and Size = 2 and PType = 'p'
ORDER BY ABS( Area - @input )`