Query random rows in mysql DB with prisma.
I'm trying to query random rows in a mysql db with prisma.
My first solution was to run a raw query, like this.
const randomOrd = await ctx.prisma
.$queryRaw
SELECT * FROM Ord ORDER BY RAND() LIMIT ${number};;
But I also want to select related tables, and using the normal prisma methods i have done that by using the INCLUDE parameter.
Is there a smart way to get random rows using prisma, and not raw queries?0 Replies