Reputation: 1730
EDIT: the problem came from my database configuration, case closed, thanks!
I have the following data set:
Roma
Romagnano
Romano
When I use the following LIKE statement: LIKE 'rom%'
I get:
Roma
Romagnano
Romano
However, when I use the statement LIKE 'roma%'
I get:
Romagnano
Romano
What LIKE statement should I use in my query to keep the line "Roma" in my results and keep the following result set if the search is based on "roma":
Roma
Romagnano
Romano
Should I use REGEXP instead? Many thanks
Upvotes: 2
Views: 98
Reputation: 2049
Something is your MySQL configuration seems to be different, since both the documentation and a simple SQLFiddle test say otherwise: it should work.
Upvotes: 3
Reputation: 1269445
I don't know what the exact configuration on your system is, but on SQL Fiddle the following returns all three values:
select *
from (select 'Roma' as val union all
select 'Romagnano' union all
select 'Romano'
) r
where val like 'roma%';
Upvotes: 2