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 ;

posted @ 2019-07-17 08:32  A汉克先生  阅读(3428)  评论(1编辑  收藏  举报