---
title: "SQL/Oracle 两表关联更新"
author: "guochongcan"
date: "2019-02-21T16:10:16Z"
tags: []
categories: ["数据库"]
slug: "sql-oracle"
draft: false
lastmod: "2019-02-21T16:10:16Z"
id: 2437914
url: "https://guocc.iteye.com/blog/2437914"
---

update info_1 a set (a.cname,a.ename) = (select b.cname,b.ename from info_2 b where b.code = a.code and rownum = 1)
where substr(a.code, 1, 2) = '11' and exists (select 1 from info_2 b where b.code = a.code)