I am trying to retrieve information from my database.
I have words like Lim Won Mong
and Limited
.
If I do my query, SELECT name FROM memberdb WHERE name LIKE '%LIM%'
, it displays both Lim Won Mong
and Limited
and I only want data from Lim Won Mong
.
How should I rewrite my query?
Introduction to SQLite LIKE operator Note that you can also use the LIKE operator in the WHERE clause of other statements such as the DELETE and UPDATE . The percent sign % wildcard matches any sequence of zero or more characters. The underscore _ wildcard matches any single character.
SQLite LIKE operator checks whether a specific character string matches a specified pattern. The operand to the right of the LIKE operator contains the pattern and the left-hand operand contains the string to match against the pattern.
In SQLite, parameters are typically allowed anywhere a literal is allowed in SQL statements. Parameters can be prefixed with either : , @ , or $ . command.
Execute following Query:
select name from memberdb where name like '% LIM %' OR name like "LIM %" OR name like "% LIM" OR name like "LIM"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With