-- Archives tracking numbers from 6 months ago, (current new month - 7), change the date in SET as well as in ship date
UPDATE trackingnumbers
SET TrackingNumber = CONCAT('2022-08-', TrackingNumber)
WHERE TrackingNumber NOT LIKE 'A%'
AND TrackingNumber NOT LIKE '2014-%'
AND TrackingNumber NOT LIKE '2015-%'
AND TrackingNumber NOT LIKE '2016-%'
AND TrackingNumber NOT LIKE '2017-%'
AND TrackingNumber NOT LIKE '2018-%'
AND TrackingNumber NOT LIKE '2019-%'
AND TrackingNumber NOT LIKE '2020-%'
AND TrackingNumber NOT LIKE '2021-%'
AND TrackingNumber NOT LIKE '2022-%'
-- AND ShipDate >= '11/01/2021 12:00 AM'
-- AND ShipDate <= '11/30/2021 11:59 PM'
AND DATE_FORMAT(ShipDate, '%Y-%m') = '2022-08'
AND LENGTH(TrackingNumber) < 23