Problem matching strings with MySQL
I am having trouble matching strings in MySQL. I have the following:
SELECT ea.*
FROM epf_application ea
JOIN epf_application_device_type ead ON ea.application_id = ead.application_id
JOIN epf_device_type edt ON e开发者_如何学Goad.device_type_id = edt.device_type_id
WHERE
edt.name = 'someDevice'
LIMIT 30
I would like to filter the above results even further by adding ea.title='%tele%'
to the above sql statement like the following
SELECT ea.*
FROM epf_application ea
JOIN epf_application_device_type ead ON ea.application_id = ead.application_id
JOIN epf_device_type edt ON ead.device_type_id = edt.device_type_id
WHERE
edt.name = 'someDevice' AND ea.title='%tele%'
LIMIT 30
The above sql statement doesn't return anything, however when I do the following I get a result.
SELECT ea.*
FROM epf_application ea
JOIN epf_application_device_type ead ON ea.application_id = ead.application_id
JOIN epf_device_type edt ON ead.device_type_id = edt.device_type_id
WHERE
edt.name = 'someDevice' AND ea.title='television'
LIMIT 30
Any suggestions on what I might be doing wrong?
Change it to
ea.title LIKE '%tele%'
I believe you want LIKE
ea.title LIKE '%tele%'
精彩评论