Solved

MySQL select record where field does not contain % character

Posted on 2014-01-02
6
1,242 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL View Syntax case etc 5 34
Query still returning duplicates 5 29
mysql date time 14 30
Creating Functions in phpMyAdmin 8 13
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 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