22,207
社区成员
发帖
与我相关
我的任务
分享
insert into table1 select NEWID(),b.DWID,'','1900-1-1',1 from table1 a,table2 b where a.DWID!=b.DWID and b.UserID in (171,3)
insert into table1
select NEWID(),b.DWID,'','1900-1-1',1 from table1 a
right join table2 b on a.DWID!=b.DWID
where b.UserID in (171,3)
insert into table1 select NEWID(),b.DWID,'','1900-1-1',1 from table2 b
left join table1 a on a.DWID=b.DWID
where b.UserID in (171,3)
and a.DWID is null
insert into table1
select NEWID(),b.DWID,'','1900-1-1',1
from table2 b where b.dwid not in(select dwid from a)
and b.UserID in (171,3)
--这样行不