日期:2014-05-17  浏览次数:20646 次

请各位看看在存储过程如何解决这问题。谢谢
例如:   表   a1已存在一条记录:
a             b         c          d  e
-----------------------------
海口   海南 中国       20        

然后   a1表与b1表关联取出以下数据
a             b         c          d  e
---------------------------------------
海口   海南 中国       20         5(   d/f,(   f为b1表)的结果   )
海口   海南 中国       20         0.67(   d/f,(   f为b1表)的结果   )

需求:把a1表与b1表所得的数据如何覆盖   a1   表中的已存在的记录,又如何把另外一条记录追加到   a1   表中

谢谢!




------解决方案--------------------
insert into a1 as
select .......
minus
select ......a1....

或者
insert into a1 select ......
where not exist(select .... from a1....)