Reputation: 2491
I have a table 'tbl1' in which there are two fields:
I am trying to create a generated column 'cut_off' of type date and column of STORED type.
I am using this command:
alter table tbl1 add column cut_off date GENERATED ALWAYS AS (DATE(created_at + num_days)) STORED;
I am getting this error:
ERROR 1292 (22007): Incorrect datetime value: '20181119063562'
But in this query:
select distinct(DATE(created_at + num_days)) from tbl1;
is running fine and giving no errors.
Any help would be highly appreciated.
Upvotes: 1
Views: 239
Reputation: 89
you are adding seconds not days, and a minute cannot have 62 seconds
perhaps try
DATE(created_at + INTERVAL num_days DAY)
Upvotes: 2