oracle两表关联更新

时间:2022-03-30 13:27:54

Oracle语法: UPDATE TableName SET (column1[,column2...])= (SELECT column1,[,column2...] FROM TableName1 [WHERE where_definition])

Oracel 示例:

update t_fare_info t
   set (t.currency_code,
        t.fare_type,
        t.allow_alone_sale,
        t.allow_combine_sale) =
       (select f.currency_code,
               f.fare_type,
               f.allow_alone_sale,
               f.allow_combine_sale
          from t_fare f
         where f.fare_id = t.fare_combine)