34,593
社区成员
发帖
与我相关
我的任务
分享
update table1 set is_has=(case when t2.id is not null then 'yes' else 'no' end)
from tabel1 t1
left jion table2 t2 on t1.id=t2.id and xdate=t1.xdate
如果是oracle数据库
update table1 set is_has=(case when exists(select 1 from table2 where ID=t1.id and xdate=t1.xdate) then 'yes' else 'no' end) from table1 t1
update table1 set is_has=(case when exists(select 1 from table2 where ID=t1.id and xdate=t1.xdate)
then 'yes' else 'no' end) from table1 t1