表 B: item_no, item_name, qty, before_qty, flag
执行条件: A.flag='0', A.qty<> B.qty, A.item_no=B.item_no
替换结果: B.flag='F9',B.before_qty=A.qty
把A表中符合执行条件的记录中的A.QTY 替换 B表中某一字段
8 个解决方案
#1
UPDATE b
SET B.flag = 'F9', B.before_qty = A.qty
FROM a
WHERE A.flag = '0'
AND A.qty<>B.qty
AND A.item_no = B.item_no
#2
UPDATE B SET flag='F9',B.before_qty=A.qty
FROM A WHERE A.flag='0' AND A.qty<> B.qtY AND A.item_no=B.item_no
#3
UPDATE B
SET flag='F9',B.before_qty=A.qty
FROM A
WHERE A.flag='0' AND A.qty<> B.qtY AND A.item_no=B.item_no
#4
同样的语句放在 access 报错,如何解决?
#5
具体错误信息?
#6
为何早不说,汗
UPDATE b
INNER JOIN a ON A.flag='0'
AND A.qty<>B.qty
AND A.item_no=B.item_no
SET B.flag = 'F9', B.before_qty = A.qty
#7
6楼的语句执行似乎有错误,提示 a.flag='0' 是不支持的连接表达式
#8
UPDATE b再试试,不行到ACCESS版提问。
INNER JOIN a
ON A.qty<>B.qty
AND A.item_no=B.item_no
SET B.flag = 'F9', B.before_qty = A.qty
WHERE A.flag='0'
#1
UPDATE b
SET B.flag = 'F9', B.before_qty = A.qty
FROM a
WHERE A.flag = '0'
AND A.qty<>B.qty
AND A.item_no = B.item_no
#2
UPDATE B SET flag='F9',B.before_qty=A.qty
FROM A WHERE A.flag='0' AND A.qty<> B.qtY AND A.item_no=B.item_no
#3
UPDATE B
SET flag='F9',B.before_qty=A.qty
FROM A
WHERE A.flag='0' AND A.qty<> B.qtY AND A.item_no=B.item_no
#4
同样的语句放在 access 报错,如何解决?
#5
具体错误信息?
#6
为何早不说,汗
UPDATE b
INNER JOIN a ON A.flag='0'
AND A.qty<>B.qty
AND A.item_no=B.item_no
SET B.flag = 'F9', B.before_qty = A.qty
#7
6楼的语句执行似乎有错误,提示 a.flag='0' 是不支持的连接表达式
#8
UPDATE b再试试,不行到ACCESS版提问。
INNER JOIN a
ON A.qty<>B.qty
AND A.item_no=B.item_no
SET B.flag = 'F9', B.before_qty = A.qty
WHERE A.flag='0'