如何提高查询性能

时间:2014-09-18 19:45:25

标签: rows multiple-columns service-accounts multiple-accounts

select serialno, companyno, customer, sourcecode, itemclass, group, subgroup, 
       case when employeecd = 'A' then 1 else 0 end, 
       case when employeecd = 'B' then 1 else 0 end, 
       case when employeecd = 'C' then 1 else 0 end, 
from sourcemarket 
where serailno in select min(serialno) 
from sourcemarket 
join customer 
  on sourcemarket.sourcecode = customer.companyno 
 and sourcemarket.customer = customer.customer 
 and sourcemarket.sourcecode = customer.sourcecode 
group by Group by companyno,customer,sourcecode,itemclass,group,subgroup

这里我们为第一个客户和EMP值(A,B,C,... I,X)构建文件,用于最少组合CSNR / SRCD / ITCL / GRP / SGRP

0 个答案:

没有答案
相关问题