0
       Update @A set Column1 = minC     
         from (select Ab.Column2, min(C.Column1) as minC 
        from @A Ab 
        inner join B on Ab.Column2 = B.Column2 
        inner join C on C.column2 = B.Column2 --No need to add again the A.col2 = B.col2
        inner join D on D.column1 = B.column2
        group by Ab.Column2) Grouped where Column2 = Grouped.Column2 

   Update @A set Column1 = minC     
    from (select Ab.Column2, min(C.Column1) as minC, B.column2 as tempcolumn
        from @A Ab 
        inner join B on Ab.Column2 = B.Column2 
        inner join C on C.column2 = B.Column2 --No need to add again the A.col2=B.col2           
        group by Ab.Column2) Grouped 
        inner join D on D.column1 = Grouped.tempcolumn
        where Column2 = Grouped.Column2 

2个查询的结果有什么区别吗?

4

0 回答 0