• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1389
  • Last Modified:

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 '%'
0
jking1234
Asked:
jking1234
  • 3
  • 2
1 Solution
 
Dale FyeCommented:
Does

WHERE [Field1] NOT LIKE '%[%]%'

work.
0
 
awking00Commented:
where field not like '\%%' escape '\'
0
 
awking00Commented:
Missed the starting wildcard character -
where field not like '%\%%' escape '\'
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Dale FyeCommented:
my expertise is Access, and that syntax would work in Access

WHERE [Field1] NOT LIKE "*[*]*"
0
 
jking1234Author Commented:
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=%referer=%referer=Studiowallpaper.net'
0
 
awking00Commented:
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?
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now