Reputation: 9833
I'm using a query such as
SELECT * FROM tablename WHERE token LIKE 'v_%'
This is resulting in records whose token starts with v_
(which is exactly what I want) but it is also showing records which start with just v
(screenshot attached)
Why is this happening? Am I missing something?
Upvotes: 1
Views: 571
Reputation: 263893
you need to _
because it is a wildcard
SELECT * FROM tablename WHERE token LIKE 'v\_%'
or
SELECT * FROM tablename WHERE token LIKE 'v|_%' ESCAPE '|';
Upvotes: 4