table1(pdqj,pdh,dwdm) table2(pdqj,pdh,kmdm,bz) 主键 pdqj,pdh现在修改table2中的bz字段,条件用table1中的dwdm sqlserver 里可以用两个表的视图
update tableview set bz where dwdm='01'oracle 里只能对表修改
update table2 set bz=1 where pdqj,pdh in (select pdqj,pdh from tableview where dwdm='01') --上面这句该怎么写,或者怎么变通?
update tableview set bz where dwdm='01'oracle 里只能对表修改
update table2 set bz=1 where pdqj,pdh in (select pdqj,pdh from tableview where dwdm='01') --上面这句该怎么写,或者怎么变通?
解决方案 »
- 关于oracle的可视化问题
- oracle10g的客户端连接oracle11g的问题
- 日期如何增加一年
- oralce中,写个简单的分页的sql,在线等
- 数据库表序列的创建相关问题的求助
- Procedure编写,怎样写Exception when
- 运行10g 的 emca时显示line 41: fg: no job control是什么原因呢?
- 序列不可以rollback吗?
- 关于在存储过程中判断是否存在该条纪录以确定是否写或是更新这条纪录失败的问题。
- 各位大侠:急需Oracle8,或者9的函数使用手册,电子版的
- sql server数据库中的表导到oracle中的问题!!
- 请教怎么用SQL 倒入文本格式文件的数据到表里去(建新表)
如果是一个主键还好,现在是两个主键,条件里没法写啊
update customers a -- 使用别名
set city_name=(select b.city_name from tmp_cust_city b where b.customer_id=a.customer_id)
where exists (select 1
from tmp_cust_city b
where b.customer_id=a.customer_id
)
-- update 超过2个值
update customers a -- 使用别名
set (city_name,customer_type)=(select b.city_name,b.customer_type
from tmp_cust_city b
where b.customer_id=a.customer_id)
where exists (select 1
from tmp_cust_city b
where b.customer_id=a.customer_id
)
update table2 t2 set bz=1 where exists(select 1 from table1 t1 where t1.dwdm='01' and t2.pdqj=t1.pdqj and t2.pdh=t1.pdh)