Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: PostgreSQL Reverse LIKE

douglas_forsell:

I need to test if any part of a Column value is in a given string, instead of whether the string is part of a column value. For instance:

This way, I can find if any of the rows in my table contains the string 'bricks' in column:


SELECT column FROM table
WHERE column ILIKE '%bricks%';

But what I'm looking for, is to find out if any part of the sentence "The ships hung in the sky in much the same way that bricks don’t" is in any of the rows. Something like:


SELECT column FROM table
WHERE 'The ships hung in the sky in much the same way that bricks don’t' ILIKE '%' || column || '%';

So the row from the first example, where the column contains 'bricks', will show up as result.

I've looked through some suggestions here and some other forums but none of them worked.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: PostgreSQL Reverse LIKE

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×