Mass update all cells in a column with a substring of it's original value I need to trim the last seven characters off of all the cells in a column.
This query returns the results that I need
SELECT test_date, SUBSTRING(test_date FROM 1 FOR CHAR_LENGTH(test_date) - 7) as test from results;

I now need to take the computed result from the substring and replace the original values.
Here's what the data looks like, if it helps.
Make a simple Update


CREATE TABLE Table1
    (`test_date` datetime)
;




INSERT INTO Table1
    (`test_date`)
VALUES
    ('2020-06-10 00:06:17.185449'),
    ('2020-06-10 00:11:05.943217'),
    ('2020-06-10 00:13:45.375109'),
    ('2020-06-10 00:13:45.461321'),
    ('2020-06-10 00:15:32.497548'),
    ('2020-06-10 00:15:32.544873')
;




UPDATE Table1 SET test_date = SUBSTRING(test_date FROM 1 FOR CHAR_LENGTH(test_date) - 7)




SELECT * FROm Table1


| test_date           |
| :------------------ |
| 2020-06-10 00:00:00 |
| 2020-06-10 00:00:00 |
| 2020-06-10 00:00:00 |
| 2020-06-10 00:00:00 |
| 2020-06-10 00:00:00 |
| 2020-06-10 00:00:00 |


db&lt;&gt;fiddle here