开发者

can i combine these update queries into one query

开发者 https://www.devze.com 2022-12-13 16:39 出处:网络
In an MS-Access database with Table called NewTable3 can i combine these 3 sql queries into one query UPDATE NewTable3 SET SAO = \'0\' WHERE SAO LIKE \'-\';

In an MS-Access database with Table called NewTable3

can i combine these 3 sql queries into one query

UPDATE NewTable3 SET SAO = '0' WHERE SAO LIKE '-';
UPDATE NewTable3 SET SAO = '0' WHERE SAO LIKE 'NULL';
UPDATE NewTable3 SET SAO = '0' WH开发者_运维百科ERE SAO LIKE 'NA';


What about using OR?

UPDATE NewTable3 
SET SAO = '0' 
WHERE (WAP LIKE '-') OR (WAP IS NULL) OR (WAP LIKE 'NA');

You can learn more about using AND and OR in SQL queries here.

The original question included the condition WAP LIKE 'NULL'. The correct notation is WAP IS NULL" and not WAP LIKE 'NULL'; Null isn't the text NULL but a special, none-textual value.


UPDATE NewTable3 
SET SAO = '0' 
WHERE (WAP LIKE '-') OR (WAP IS NULL) OR (WAP LIKE 'NA');
0

精彩评论

暂无评论...
验证码 换一张
取 消