select distinct d.*,cast(box_no as int),e.customer_code,.... from .... order by customer_code,cast(box_no as int)
其中select 后面总共列出了24个字段,共有6张表联查,基本都是通过“left outer join ... on ...”这样的条件来连接的,感觉查询很慢,只查询出来10万条记录都需要大约7秒钟,不知道如何改进?
另外,我吧最后的那个排序由“order by customer_code,cast(box_no as int)”改为“order by d.id” 之后,速度快了大约一秒,但是我并不需要d.id这个排序,怎么办?这其中的奥妙是什么?怎样提高速度?