Solved

MySQL select record where field does not contain % character

Posted on 2014-01-02
6
1,261 Views
Last Modified: 2014-02-06
I have a table where field 1 is a varchar. I want to select records where field 1 does not contain the character '%'
0
Comment
Question by:jking1234
  • 3
  • 2
6 Comments
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39751409
Does

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

work.
0
 
LVL 32

Accepted Solution

by:
awking00 earned 250 total points
ID: 39751450
where field not like '\%%' escape '\'
0
 
LVL 32

Expert Comment

by:awking00
ID: 39751452
Missed the starting wildcard character -
where field not like '%\%%' escape '\'
0
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39751466
my expertise is Access, and that syntax would work in Access

WHERE [Field1] NOT LIKE "*[*]*"
0
 

Author Comment

by:jking1234
ID: 39758861
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
 
LVL 32

Expert Comment

by:awking00
ID: 39759202
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

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question