I want to select only records where a field DOES NOT contain a string in it...
So for instance, the contents of the fields might be:
Record 1: 1, bla bla bla i rock http://www bla bla bla
Record 2: 2, wowzers that rocks bla balj
Record 3: 3, this rocks mysql is great http://www.blue
Now, I want to select all records where that field DOES NOT have http:// in it. So it should JUST SELECT RECORD 2.
Whats the syntax for that?
SELECT WHERE field DOES NOT CONTAIN a string??? HOW?
Moderator: General Moderators
-
superwormy
- Forum Commoner
- Posts: 67
- Joined: Fri Oct 04, 2002 9:25 am
- Location: CT
You should be able to use "not like" to do this:
You can also do it with a regular expression using REGEX. See the MySQL docs at http://www.mysql.com/doc/en/String_comp ... tions.html
Code: Select all
select * from table
where field NOT LIKE '%http://%' ;