Insert select 和 update select 操作
2015-11-24 17:39
435 查看
--将已导入ecc_base_order_his历史表中的ECC_CYCLE_TRANSFER_ACCOUNTS数据有效期未过期预约类数据copy到 --ecc_base_order中 insert into ecc_base_order ebo select * from (select his.* from ecc_base_order_his his where his.order_no in(select b.order_no from ecc_cycle_transfer_accounts b left join ecc_base_order a on a.order_no=b.order_no where b.tran_type in('01','02') and b.plan_status in('00','01') and b.cycle_type <> '00' and a.order_no is null )) --将ecc_base_order 和 ecc_cycle_transfer_accounts 中的VALID_STOP_DATE和VALID_TIME一致 update ecc_base_order ebo set ebo.valid_time = ( select ecta.valid_stop_date from ecc_cycle_transfer_accounts ecta where ecta.order_no = ebo.order_no and ecta.tran_type in('01','02') and ecta.plan_status in('00','01') and ecta.cycle_type <> '00') where ebo.order_no = ( select ecta.order_no from ecc_cycle_transfer_accounts ecta where ecta.order_no = ebo.order_no and ecta.tran_type in('01','02') and ecta.plan_status in('00','01') and ecta.cycle_type <> '00')
相关文章推荐
- 数据库操作优化(insert、update、delete、select)
- datanucleus+spring 的JDO操作 select save update delete
- 处理死锁 阻塞问题预备知识之SELECT,UPDATE,DELETE操作需要申请的锁(一 SELECT操作)
- MySQL中Update、select联用操作单表、多表,及视图与临时表的区别
- mysql 不能对同一个表进行 update(delete) 和 select 联合操作
- jdbctemplate 的insert、update、delete以及select操作
- python sqlite3 连接到数据库,创建表,INSERT 、SELECT、UPDATE 、DELETE等简单操作
- sqlserver高并发情况下 select 和update操作造成死锁的解决方法
- PDO insert update select操作应该选择哪个方式
- 数据库操作优化(insert、update、delete、select)
- mysql-update、delete、select操作
- sqlserver高并发情况下 select 和update操作造成死锁的解决方法
- 掌握SQL四条最基本的数据操作语句:Insert,Select,Update和Delete
- 关系数据库标准语言SQL的基本操作:SELECT, CREATE, DROP, ALTER, INSERT, UPDATE, DELETE
- 掌握SQL四条最基本的数据操作语句:Insert,Select,Update和Delete
- oracle用select for update 中断后无法操作表的处理:杀掉SESSION
- 数据库SQL 表的基本操作(create,drop,alter,insert,update,delete,select)
- 数据记录的操作(insert,select,update,delete)函数和分组查询(group by),表连接(join on),嵌套查询(in)
- mysql之update select 操作
- MySQL中Update、select联用操作单表、多表,及视图与临时表的区别