I’m having a dumb moment and forgetting how to achieve something in SQL.
Let’s say I have a custom record type customrecord_my_record and one of these records has the name “DEF GHI JKL”
I want to be able to accept a keyword, e.g. “GHI” or “ABC DEF GHI JKL MNO”, store it in a variable, and run a SQL to have it match my record. Both these keyword examples would be considered a match: it should match if the keyword is a substring of the name or if the name is a substring of the keyword.
I can do “keyword is a substring of the name” fairly easily:
let sql = “SELECT * FROM customrecord_my_record WHERE name LIKE ‘%” + keyword + “%‘“;
How do I also make it match the latter? Something like
let sql = “SELECT * FROM customrecord_my_record WHERE name LIKE ‘%” + keyword + “%’ OR ‘%’ || name || ‘%’ LIKE ‘” + keyword + “’”;