---
title: "sql"
author: "hehaisu"
date: "2013-04-01T17:20:01Z"
tags: ["SQL", "批处理"]
slug: "sql"
draft: false
lastmod: "2013-04-01T17:20:01Z"
id: 1840236
url: "https://heiwado.iteye.com/blog/1840236"
---

sql从一张表的数据更新到另一张表

```sql

UPDATE 表B SET 表B.字段1=（select 表A.字段1 from 表A where 表A.id=表B.id）where exists(select 1 from 表A where 表A.id=表B.id)

```