jking1234
asked on
MySQL select record where field does not contain % character
I have a table where field 1 is a varchar. I want to select records where field 1 does not contain the character '%'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Missed the starting wildcard character -
where field not like '%\%%' escape '\'
where field not like '%\%%' escape '\'
my expertise is Access, and that syntax would work in Access
WHERE [Field1] NOT LIKE "*[*]*"
WHERE [Field1] NOT LIKE "*[*]*"
ASKER
where field not like '%\%%' escape '\' works ok in my test table but does not work on the real table where the field value is similar to
'%referer=%referer=%refere r=%referer =Studiowal lpaper.net '
'%referer=%referer=%refere
Don't know why that shouldn't work. Can you provide some sample data for the field1 from your real table and what you would expect the output to be?
WHERE [Field1] NOT LIKE '%[%]%'
work.