sql对比两个表
发布时间: 2023-08-27 10:24:08
⑴ SQL如何对比两张表的数据
insert
into
tablea
select
*
from
tablea
where
not
exists
(selelct
'1'
from
tableb
where
tablea.serverid
=
serverid
and
tablea.driverid
=
driverid
and
tablea.driversize
=
driversize)
update
tablea
set
tablea.driversize
=
tablea.driversize
from
tablea
,tableb
where
tablea.serverid
=
serverid
and
tablea.driverid
=
driverid
如果你以tableb为准的话,你最好在tableb上加个触发器
热点内容