select
项目号,
SUM(case when 单号 like 'AB%' and 投递日期 IS null then 1 else 0 end) as 'AB',
SUM(case when 单号 like 'ABC%' and 投递日期 IS null then 1 else 0 end) as 'ABC',
SUM(case when 单号 like 'ABD%' and 投递日期 IS null then 1 else 0 end) as 'ABD'
from table1 GROUP BY 项目号
group by 项目号 asc