Hi,
I have a database table name "test" with one field name "fname" and in that table I have an entry "abc\123". I tried running the queries below and got no result.
select * from test where fname like '%abc\123%'
or
select * from test where fname like '%abc\\123%'
I'm not sure if the mysql like syntax have any problem with backslashes but is there a way to get around this?
mysql like syntax with backslash
Moderator: General Moderators
Re: mysql like syntax with backslash
thomas wrote:Hi,
I have a database table name "test" with one field name "fname" and in that table I have an entry "abc\123". I tried running the queries below and got no result.
select * from test where fname like '%abc\123%'
or
select * from test where fname like '%abc\\123%'
I'm not sure if the mysql like syntax have any problem with backslashes but is there a way to get around this?
could do the job... but also can give you unwanted records... per example this records will be returned also:select * from test where fname like '%abc%'
or
select * from test where fname like '%abc%123%'
fname="abcjsd jsd j jsd jhs"
faname="abc shdjhjashd 123 hsdhjashd"
and this
should solve your patternselect * from test where fname like '%abc_123%'