SELECT whab,ptype,mo,partno,name,spec,note,abs(qty),unit,abs(qty2),unit2,formno,dept,datea,username
FROM t_invList
WHERE (DateA BETWEEN '2006-5-1' AND '2006-5-31') AND (dept not LIKE '%键盘A%' OR
dept not LIKE '%B%' OR
dept not LIKE '%C%' OR
dept not LIKE '%D%' OR
dept not LIKE '%E%' OR
dept not LIKE '%F%' OR
dept not LIKE '%G%' OR
dept not LIKE '%H%' OR
dept not LIKE '%I%' OR
dept not LIKE '%J%') and wh ='ls' and dept like '%键盘%')
ORDER BY mo,dept,formno
我的本意是把所有含键盘的数据都得到,但不含有字母A,B,C,D...,可是我得到的有含这些字
母的,大家帮我修改一下?谢谢!
FROM t_invList
WHERE (DateA BETWEEN '2006-5-1' AND '2006-5-31') AND (dept not LIKE '%键盘A%' OR
dept not LIKE '%B%' OR
dept not LIKE '%C%' OR
dept not LIKE '%D%' OR
dept not LIKE '%E%' OR
dept not LIKE '%F%' OR
dept not LIKE '%G%' OR
dept not LIKE '%H%' OR
dept not LIKE '%I%' OR
dept not LIKE '%J%') and wh ='ls' and dept like '%键盘%')
ORDER BY mo,dept,formno
我的本意是把所有含键盘的数据都得到,但不含有字母A,B,C,D...,可是我得到的有含这些字
母的,大家帮我修改一下?谢谢!
dept not LIKE '%B%' OR
dept not LIKE '%C%' OR
dept not LIKE '%D%' OR
dept not LIKE '%E%' OR
dept not LIKE '%F%' OR
dept not LIKE '%G%' OR
dept not LIKE '%H%' OR
dept not LIKE '%I%' OR
dept not LIKE '%J%'这个条件里的or应该改成and吧?是不含a并且不含b...而且以上语句可以改为
PATINDEX('%[A-J]%',dept) = 0
FROM t_invList
WHERE (DateA BETWEEN '2006-5-1' AND '2006-5-31') AND (dept not LIKE '%键盘[A-Z]%'and wh ='ls' and dept like '%键盘%')
ORDER BY mo,dept,formno
FROM t_invList
WHERE (DateA BETWEEN '2006-5-1' AND '2006-5-31') AND (dept not LIKE '%[A-J]%'and wh ='ls' and dept like '%键盘%')
ORDER BY mo,dept,formno
AND NOT (dept LIKE '%A%' OR dept LIKE ..或者将里面的所有OR 换成AND
AND (dept NOT LIKE '%A%' AND dept ...或者用集合AND dept NOT LIKE '%[A-Z]%'如果你仅仅只是不选出 A,B,C,D,E,H这几个,那么改成
AND dept NOT LIKE '%[ABCDEH]%'