我想更新table1中的column1只有当table1中的column2与table2中的column3匹配时 我正在尝试使用此查询,但我得到一个错误,说我是缺少等号。 任何人都可以提供帮助吗?更新table1中的column1只有当与table2中的column3匹配时
update schema1.table1 set schema1.table1.column1
where schema1.table1.column2 = table2.column1
我想更新table1中的column1只有当table1中的column2与table2中的column3匹配时 我正在尝试使用此查询,但我得到一个错误,说我是缺少等号。 任何人都可以提供帮助吗?更新table1中的column1只有当与table2中的column3匹配时
update schema1.table1 set schema1.table1.column1
where schema1.table1.column2 = table2.column1
你的错误说明了一切。您没有为该列分配任何值。尝试使用等于设定值=标志
你可以试试这个: -
update shema1.table1
set shema1.table1.culomun1 = //The value which you want to store
where shema1.table1.culomun2 = table2.culomun1
随着错误消息,你已经错过了=
并在查询未分配的shema1.table1.culomun1
任何价值。
尝试这样,
UPDATE shema1.table1
SET shema1.table1.culomun1 =<your_value>
WHERE shema1.table1.culomun2 = table2.culomun1;
尝试此查询:
update shema1.table1 t1 set t1.culomun1 = (select t2.culomunX from table2 t2
where t1.culomun2 = t2.culomun1)
where t1.culomun2 in (select culomun1 from table2)