SQL优化:从一个表中选择不同的

时间:2012-09-21 09:42:31

标签: sql oracle query-optimization

假设我有一个像这样的SQL

select  distinct CUSTOMER_PRODUCT_ORDER as ORDER
from MASTER_LIST 
where PROJECT_ID     = "ABCDD"
 order by   ORDER ASC

如何优化运行此sql的性能?

1 个答案:

答案 0 :(得分:-1)

我认为在大多数情况下,使用group by会更好,更高效:

select  CUSTOMER_PRODUCT_ORDER as ORDER
from MASTER_LIST 
where PROJECT_ID     = "ABCDD"
GROUP BY CUSTOMER_PRODUCT_ORDER
 order by   ORDER ASC