I am trying to retrieve multiple records from my DB with the following query:
User.where('name ilike ?','%thomas%')
this works fine. Now I want to retrieve multiple records at the same time and tried this (which seems to be syntactically incorrect):
User.where('name ilike any',['%thomas%','%james%','%martin%'])
What am I doing wrong?
So just to clarify: I want to retrieve all records that match one of the names, so its an OR statement I am looking for.
You can do it by
User.where('name ilike any ( array[?] )',['%thomas%','%james%','%martin%'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With