[thelist] SQL: Like 'S%', but not like '%safety%'

Jay Blanchard jay.blanchard at niicommunications.com
Wed Jan 19 09:39:34 CST 2005


[snip]
I'm trying this simple simple SQL query, but for some odd reason, it's
not
working. The subject line is pretty much it. Specifically:

...and ((o.PONumber like 'C%'  OR o.PONumber like 'S%') and (not
o.PONumber
like '%safety%' or not o.PONumber  like '%saftey%')) ORDER BY ...

I want to pull up PO's that begin with 'C%' or 'S%', but at the same
time,
it's also pulling up PO's with the word Safety (and the misspelled
variety
of Saftey). 

Any ideas?
[/snip]

...and ((o.PONumber like 'C%'  OR o.PONumber like 'S%') and (o.PONumber
NOT LIKE '%safety%' OR o.PONumber  NOT LIKE '%saftey%')) ORDER BY ...

is typical SQL syntax


More information about the thelist mailing list