1.尽量不要在where中进行计算,尤其是需要遍历的情况原来代码,执行大约40秒 INSERT INTO @TransferCode ( PROXY_NO, TING_NO, WTotal, BTotal ) SELECT H.PROXY_NO, H.TING_NO, END), END) FROM dbo.CM_ROCARDB AS B LEFT JOIN dbo.CM_ROCARDH AS H ON B.BARCODE = H.BARCODE LEFT JOIN dbo.CM_PROXY A…