[thelist] SQL: Like 'S%', but not like '%safety%'
Rob Smith
rob.smith at THERMON.com
Wed Jan 19 10:53:24 CST 2005
...and ((o.PONumber like 'C%' OR o.PONumber like 'S%') and (o.PONumber NOT
LIKE '%safety%' OR o.PONumber NOT LIKE '%saftey%')) ORDER BY ...
/\/\/\/\/\
Ah hah. That was kinda what I was looking for, but still returned all the
results. After thinking about what you were suggesting, I modified it to be:
... and ((o.PONumber like 'C%' OR o.PONumber like 'S%') and (o.PONumber <>
'safety stock' AND o.PONumber <> 'saftey stock' AND o.PONumber <> 'SAFETY
STOCK' AND o.PONumber <> 'SAFETY STOCK' AND o.PONumber <> 'SAFTY STOCK' AND
o.PONumber <> 'STOCK' AND o.PONumber <> 'stock shipped')) ORDER BY ...
I found that that the like was inclusive of everything still showed up. I
had to search and weed out the 'exact' matches of what I didn't want as
strings without wildcards. The AND also helped.
Thanks again,
Rob
More information about the thelist
mailing list