How to use ILIKE for multiple values in single column.
This is the solution for multiple values without using like condition:
Project.where(name: ["Arvind Oasis", "Prestige Jindal City"])
In this example, it is taking the exact matches in my database. but i want to take similar matches for all the values.
How to use ILIKE for multiple values ["Arvind Oasis", "Rajkumar Jindal City"]
For single values i can use like this,
Project.where("name ILIKE ?", "%Prestige Kumar%")
Use:
Project.where("name ILIKE ANY (array[?])", ["%Arvind Oasis%", "%Prestige Jindal City%", "%XXXX%"])
You can try postgres SIMILAR TO operator like below
Project.where("name similar to '%(Arvind\sOasis|Rajkumar\sJindal\sCity)%'")
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