使用NOT LIKE运算符更新

时间:2013-07-01 14:39:11

标签: ms-access

UPDATE Table
    SET Table.[Field] = 'DUMMY' WHERE Table.[Acct Numb] not like 
( '*01'. '*03'. '*04'. '*07'. '*08'. '*09');

我可以使用NOT LIKE运算符使用更新查询吗?我正在使用MS ACCESS执行此查询。

由于

2 个答案:

答案 0 :(得分:3)

您可以使用not like,但不能使用列表:

UPDATE Table
    SET Table.[Field] = 'DUMMY'
    WHERE Table.[Acct Numb] not like '*01' and
          Table.[Acct Numb] not like '*03' and
          Table.[Acct Numb] not like '*04' and
          Table.[Acct Numb] not like '*07' and
          Table.[Acct Numb] not like '*08' and
          Table.[Acct Numb] not like '*09';

您也可以将其改为:

update table
     SET Table.[Field] = 'DUMMY'
     where right(Table.[Acct Numb], 2) not in ( '01'. '03'. '04'. '07'. '08'. '09')

答案 1 :(得分:1)

基于MS参考访问,以及@Alex K建议

http://office.microsoft.com/en-sg/access-help/access-wildcard-character-reference-HP005188185.aspx

你应该可以这样做:

UPDATE Table
    SET Table.[Field] = 'DUMMY'
    WHERE Table.[Acct Numb] not like '*0[134789]'