select 物料类型,count(distinct 物料号) as 面料数 from 物料清单表
join 面料信息表 using(物料号)
where 设计师 = 1 and (物料类型 = '面料' or 物料类型 = '辅料')
group by 物料类型
order by 面料数 desc