level 6
select * from Aa , Bb where a.id=b.id and a.table_par>='20181001' and b.id_number is null
查询出来的空值,C表格里面有数据,需要往B表格里面插入这些数据,C表和B表ID一样。
求大神解答,学习一下。
2018年11月26日 14点11分
1
level 2
从需求上看你是要Update B 表格的 id_number:
update B set B.id_number = C.id_number FROM B b left join A a on a.id=b.id left join C c on c.id = b.id where a.table_par >= '20181001' and b.id_number is null
2018年11月26日 15点11分
2
level 3
update B set table_par = (select table_par from C where id = B.id)
where
id_number is null
and
id in (select id from A where table_par>='20181001')
2018年11月28日 02点11分
4