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
在这里,我们正在为 CSNR/SRCD/ITCL/GRP/SGRP 的最小组合构建第一个客户和 EMP 值(A、B、C、... I、X)的文件