使用sql实现将一张表的某些字段数据存到另一种表里
1.新增
INSERT INTO SS.T_SS_HRAREA (GUID, HRAREA_CODE,HRAREA_NAME,HRAREA_FULL_NAME,ORG_CODE,DELETE_FLAG,TENANT_CODE)
SELECT info.GUID,info.ORG_CODE,info.ORG_NAME,info.ORG_NAME,info.ORG_CODE,info.DELETE_FLAG,info.TENANT_CODE
FROM OG.t_og_org_organization_info info
WHERE info.DELETE_FLAG = '0';
2.修改
UPDATE SS.T_SS_HRAREA a SET a.ORG_CODE =
(SELECT info.ORG_CODE
FROM OG.t_og_org_organization_info info
WHERE info.DELETE_FLAG = '0' and info.guid = a.guid);