Reputation: 11
Is there any way to remove exact match result from MySQL LIKE operator?
I have a column in a table that contain words like:
So, when I query for "Abort", I just want to display related word for "Abort" not exact "Abort". I just want to remove it from result.
I use this simple MySQL query code:
mysqli_query($conn, "SELECT * FROM medi_words WHERE word LIKE '%$query%'");
Upvotes: 0
Views: 333
Reputation: 3669
You can use another condition in the query like so:
mysqli_query($conn, "SELECT * FROM medi_words WHERE word LIKE '%$query%' AND word != '$query'");
Upvotes: 3