select id, name from table
where name ilike all(string_to_array(replace('%JOHN DOE%',' ','%,%'), ','))
-- 1) it converts spaces into commas (,)
-- 2) it converts string to array using resulting comma separated string
-- 3) it apply ilike to each word in search string
-- It finds (for example) name = 'DOE, JHON' in table
Find string which has any of the words into a search string:
1) it converts spaces into commas (,)
2) it converts string to array using resulting comma separated string
3) it apply ilike to each word in search string
It finds (for example) name = 'DOE, JHON' in table
1) it converts spaces into commas (,)
2) it converts string to array using resulting comma separated string
3) it apply ilike to each word in search string
It finds (for example) name = 'DOE, JHON' in table
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.