SELECT FLAG COUNT(*) AS ZSUM FROM ZWM_PACKCODE AS A INNER JOIN MARA AS B ON A~MATNR = B~MATNR WHERE B~EXTWG = 'B01' AND A~ERDAT LE '20220419' AND A~ERDAT LE '20170419' GROUP BY FLAG