I have a list of strings. They are all absolute paths (no relative at the moment) and they all start with \ (windows folder separator)
When I do a query with a like using
select * from list where name like @foo
and foo is
@"\a" + %
I get no results. If I use %\a% I get results. I then tried using mysql command line and wrote
where name like '\a%' limit 10;
I get no results there as well unless i write %\a%. Why doesn't it like \? and how do i have a string start with \a? I don't want to get \random\apples\file when I am expecting \apples\file
2 Answers 2
Because \ is the escaping character .
Try replacing it with \\ instead
2 Comments
try this
\ is a sign which escapes the next sign.. sometimes used to escape a \" quote or the backslash itself
where name like '\\a%' limit 10;
@"\\a" + %?