I have searched the forum for an answer to this very simple question but I must be going blind (wood and trees and all that..)
I have a very simple database that holds lots of codes. I want to retrieve all these codes but exclude ones that have certain characters in them.
For instance say I have a code like "ABC-123-456-789-DEF" (without quotations), I want to be able to retrieve all the codes that don't have "456" in them.
I have tried a "NOT" statement with and this doesn't do what I want.
This is what I have
Code: Select all
SELECT code
from code_data
where code like ('%123-456-789%')Code: Select all
SELECT code
from code_data
where code like ('%123-456-789%')
and not (code = '%456%') I'm sure this is very simple but I just can't get it to work!
Many thanks for all your help!
regards
Peter