Replies: 1 comment
-
await fastify.prisma.user_info.findMany({
distinct: ["role"],
select: {
role: true
},
orderBy: {
role: {
sort: "desc",
nulls: "last"
}
}
}) or use await fastify.prisma.user_info.findMany({
distinct: ["role"],
take: req.query.limit,
skip: req.query.page * req.query.limit,
select: {
role: true
}
}) I created the issue: #22734 It looks like we have to work around this problem by using subqueries: https://stackoverflow.com/questions/9795660/postgresql-distinct-on-with-different-order-by |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Support for the database native
DISTINCT
queries with ourdistinct
API is in preview behind thenativeDistinct
preview feature.Please share your feedback about
nativeDistinct
released in v5.7.0 in this discussion.Beta Was this translation helpful? Give feedback.
All reactions