blocnt blocnt - 10 months ago 32
MySQL Question

mysql - Use two "%" in LIKE clause

I want to use something like

FROM blabla
WHERE date LIKE '2014%'
AND name = 'Jo%'
AND (( price > 0
OR time > 10));

But it doesn't return results because of

name = 'Jo%'

(but I know that there are results). I've tried 'Jo*' but it doesn't work.
It seems that only let one "%", right after LIKE clause.

How can I fix this?


You would use date LIKE '2014%' AND name LIKE 'Jo%', because the equals sign does not perform that pattern matching.