Ver originalSELECT almacen, codigo, COUNT(DISTINCT folio) di FROM datos WHERE codigo='87322' AND folio LIKE 'A%' GROUP BY almacen, codigo