SQL把a表字段数据存到b表字段 update,,insert
Posted gzhbk
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL把a表字段数据存到b表字段 update,,insert相关的知识,希望对你有一定的参考价值。
update SYS_Navigation set
SYS_Navigation.PARENT_XH = SYS_Power_menu.parent_id,
SYS_Navigation.web_title = SYS_Power_menu.menu_name,
SYS_Navigation.WEB_FLAG=1,
SYS_Navigation.url=SYS_Power_menu.url
from SYS_Power_menu
where SYS_Navigation.xh = SYS_Power_menu.menu_id;
------------------------------------------------------
格式、
------------------------------------------------------
--insert into B (id,columnB) select id,columnA from A where id not in (select id from B)
-------------------------------------------------------
INSERT INTO SYS_Power (
UserOrGroupID,
UGTYPE,
POWERtype,
source,
navigationXH
) SELECT
1,
0,
4,
1,
SYS_Navigation.xh
FROM
SYS_Navigation
WHERE
SYS_Navigation.xh in (select navigationXH from SYS_Power ) AND SYS_Navigation.WEB_FLAG=1 ;
以上是关于SQL把a表字段数据存到b表字段 update,,insert的主要内容,如果未能解决你的问题,请参考以下文章