今天遇到的几个点,很长时间没用了记录下
查询关联数据后更新
update 表a set a.字段1 =b.字段1 ,a.字段2 =b.字段2
from 表a a inner join 表b b with(nolock) on a.相关字段=b.相关字段
where isnull(a.字段1,'')<> '' or a.字段2 is not null
详细可参考:https://www.cnblogs.com/baili-luoyun/p/11136698.html
查询各分组中一条记录
select b.* from
(select a.*,row_number() over (partition by 列1 order by 列2 desc) rn
from a) b
where rn=1;
参考:https://blog.youkuaiyun.com/zhu_nana/article/details/51729013
导出脚本,含结构和数据
最主要的一步
详细可参考:https://jingyan.baidu.com/article/eae07827ad76ba1fed548573.html