Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个两个表A,B其中两个列都是通用的,只有当两个值相同并且给出时P我才需要使用update命令table BpC column from table A
A
B
P
update
table B
p
C column from table A
我正在尝试的是:
update B set P =100 where B.P=A.P and A.C=60
但它给了我错误没有这样的专栏A.P
A.P
您正在更新表 B 并且没有对表 A 的引用,因此 sqlite 只是不知道在哪里寻找。尝试这个:
UPDATE B SET P = 100 WHERE B.P IN (SELECT A.P FROM A WHERE A.C = 60)
你可以这样做
Update B set P = 100 WHERE B.P = (Select P from A WHERE C = 60)