select count(*) from (select 单号, 类型 from 表 group by 单号, 类型) k