快乐星光 回复 用户e0818694(提问者)select o.字段单号,o.日期,e1.检验类型 as 维修,e2.检验类型 as 合格,e3.检验类型 as 报废,
count(1)over (partition by 1) rownum
from AAA o
left join ABC e1 on o.id=e1.id and e1.检验类型=\'维修\'
left join ABC e2 on o.id=e2.id and e2.检验类型=\'合格\'
left join ABC e3 on o.id=e3.id and e3.检验类型=\'报废\'
快乐星光 回复 用户e0818694(提问者)select o.字段单号,o.日期,e1.检验类型 as 维修,e2.检验类型 as 合格,e3.检验类型 as 报废,
count(1)over (partition by 1) rownum,
count(1)over (partition by o.字段单号 ) 同一单号数量,
count(1)over (partition by o.id ) 同一ID数量
from AAA o
left join ABC e1 on o.id=e1.id and e1.检验类型=\'维修\'
left join ABC e2 on o.id=e2.id and e2.检验类型=\'合格\'
left join ABC e3 on o.id=e3.id and e3.检验类型=\'报废\'