常用sql的写法|有则更新无则插入。
mysql写法:
-- update...by 杨员外
update tabT t inner join tabF f
on t.ad=f.ad
set
t.name=f.name,
t.sex=f.sex;
-- insert...by 杨员外
insert into tabT
(
ad,name,sex
)
select
ad,name,sex
from tabF f where not exists(select 1 from tabT t where t.ad=f.ad );
oracle写法:
-- update...by 杨员外@2018 --
update tabT t set
(name,sex)
=
(select name,sex from tabF f where t.ad=f.ad )
where exists(select 1 from tabF f2 where t.ad=f2.ad );
-- insert...by 杨员外@2018 --
insert into tabT
(
ad,name,sex
)
select
ad,name,sex
from tabF f where not exists(select 1 from tabT t where t.ad=f.ad );
标签:
优品分享(-892)
上一篇: Remote Desktop 用户或密码不起作用|访问win10的远程桌面(Remote Desktop)总是凭据或者用户密码错误 |the user or password did not work
下一篇: 重启还原精灵|重启还原|影子系统|还原精灵
下一篇: 重启还原精灵|重启还原|影子系统|还原精灵
相关文章
评论列表(0) 订阅
暂无评论
禁止评论