I'm trying to compose a WHERE statement that will match rows where a column value is a substring of another string.
For example, I might have an event record with a name field of Edward Sharpe. I'd like to do something like:
SELECT * FROM events WHERE(name LIKE 'Edward Sharpe and the Magnetic Zeroes');
This doesn't work. I've also various permutations of:
SELECT * FROM events WHERE('%' || name || '%' LIKE 'Edward Sharpe and the Magnetic Zeroes');
Which also doesn't work.
select 'Edward Sharpe and the Magnetic Zeroes' like '%' || name || '%' from (select 'Edward Sharpe'::text "name") foo?true, if I'm not mistaken.