Reputation: 3695
Hi I have a database that lists expiration dates etc...
5-22-2012
5-22-2012
5-22-2012
5-22-2012
but some came out like
5-22-1912
5-22-1912
5-22-1912
is there a way to REPLACE just those years at the end of my columns?
Upvotes: 1
Views: 216
Reputation: 115510
If field is DATE
type:
--- Add 100 years when date is before 1940
UPDATE TableX
SET expirationDate = expirationDate + INTERVAL 100 YEAR
WHERE expirationDate < '1940-01-01'
Upvotes: 4
Reputation: 2436
UPDATE table
SET thiscolumn = CONCAT(month(thiscolumn),'-', day(thiscolumn),'-2012')
WHERE year(thiscolumn) = '1912';
Upvotes: 1