Hey guys, is there any way to use raw sql function...
# orm-help
l
Hey guys, is there any way to use raw sql functions in only one parameter of a "where"? Basically, I have this string field, and I want to filter the rows where this field is equal to some certain value, but the thing is, that value can come with some padded zeroes, but I still want them, like, I also want rows with "0012345" when looking for "12345", is that possible?
n
Hey Levy 👋
I also want rows with “0012345” when looking for “12345", is that possible?
If the values are stored as
String
values, you should be able to use
contains
or even
endsWith
to make this happen. So something like:
Copy code
await prisma.model.findMany({
  where: {
    fieldName: {
      endsWith: "12345"
    }
  }
})
If you have more specific needs and actually need some filter conditions that can not be expressed via the Prisma Client API, you can add a 👍 and a comment to this feature request with your concrete use case to help our Product and Engineering teams prioritize this 🙂 Let me know if that helps 🙌