Idsa Idsa - 11 months ago 102
MySQL Question

MySQL like another field

I have a table with two string columns: Url and ModelId. I need to return records for which Url contains ModelId, something like this:

SELECT Id, Url, ModelId WHERE Url like "%ModelId%"

Answer Source
SELECT Id, Url, ModelId 
WHERE Url LIKE CONCAT('%', ModelId, '%')