SELECT Mid([设备编号],3,4) AS 名称编号, Sum((IIf(Len([牌照号])=6,1,0))) AS 有牌数量, Sum((IIf(Len([牌照号])<>6,1,0))) AS 无牌数量
FROM tbl_car
WHERE (((Mid([设备编号],3,2))="01" Or (Mid([设备编号],3,2))="02" Or (Mid([设备编号],3,2))="03" Or (Mid([设备编号],3,2))="09") AND ((tbl_car.淘汰日期) Is Null))
GROUP BY Mid([设备编号],3,4);