ms sql in 优化
原始sql 执行半小时, 临时表gl_tmp1里大概2万条数据
select distinct ( gl_detail.pk_voucher ) from gl_detail , gl_contrast where gl_detail.pk_detail = gl_contrast.fk_detail and gl_detail.pk_voucher in ( select pk from gl_tmp1 )
优化后sql
select distinct ( gl_detail.pk_voucher ) from gl_detail , gl_contrast , gl_tmp1 where gl_detail.pk_detail = gl_contrast.fk_detail and gl_detail.pk_voucher = gl_tmp1.pk