1、问题贴见(这里一个注意点为:coalesce(字段,0) 使用,即判断这个字段是否为NULL,如果为NULL,则为0)
select tt.uname,tt.sumstart,ttt.laststart from ( select id,name as uname, COALESCE(SUM(start),0) as sumstart from [user] t1 left join team t2 on t1.id=t2.uid group by id,name ) tt, ( select t1.id,t1.name as uname, COALESCE(start,0)as laststart from [user] t1 left join team t2 on t1.id=t2.uid and data=(select MAX(data) from team) ) ttt where tt.id=ttt.id;

级联更新表字段
update ST_PPTN_D set LGTD= a.LGTD,LTTD=a.LTTD from ST_STBPRP_B a inner join ST_PPTN_D p on p.STCD=a.STCD;