-
Notifications
You must be signed in to change notification settings - Fork 6
Tilda Database functions: Multi Like
Laurent Hasson edited this page Sep 17, 2019
·
2 revisions
<-- Common Helper Database Functions
Source code in PostgreSQL.helpers-start.sql
You can write a query like this:
select *
from some_table
where some_col like 'M1330%'
or some_col like 'M1340%'
or some_col like 'M1350%'
Or you can use the helper function Tilda.Like and write the query like this:
select *
from some_table
where Tilda.like(some_col , ARRAY['M1330%','M1340%','M1350%'])
There is an overload of the function for Array Values as well if any value in the first array is matched by any value in the second array.
select Tilda.like(ARRAY['ABC','123'], ARRAY['%B%','%3%'])
There is an iLike variant that does case-insensitive matches.
select Tilda.ilike(ARRAY['ABC','123'], ARRAY['%b%','%3%'])
🎈 NOTE: These example is using the syntax of PostgreSQL, which supports Arrays.