Are there any differences between the results of t

2019-08-20 11:54发布

问题:

       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 

and

   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 

Are there any difference between the results of the 2 queries?