What is the best a way to use `OR` filter in where...
# orm-help
h
What is the best a way to use
OR
filter in where clause in such way that the first condition in
OR
is checked throughout the db and if it does not exist try with the second one.
Copy code
const result = await prisma.findFist({
   where:{
      OR:[
         {"condition 1"},{"condition 2"}
     ]
   }
})
If filter condition 1 is not matched with any record , then only try for condition 2
👀 1
n
Hey Hussam 👋 I am not sure if this would be possible in a single query. The most straightforward approach would be to separate it into two queries. The first query just matches
condition 1
and based on the response of the first query, whether the second query should be invoked or not could be decided.
v
👋 Hello @Hussam Khatib - did you have a chance to check Nurul's comment? Let us know if this is still an open question!