sql - Inserting an older date in mysql table -
tried query entry 2 day older date
insert `subject` (`id` ,`marks` ,`entry`) values ('12121', '12','current_date()-2');
it gives
id | marks | entry 12121 12 0000-00-00
also tried 'current_date() interval 2'
you inserting string date column. string gets converted number value of 0
. instead, try this:
insert subject(id, marks, entry) select '12121', '12', current_date() - interval 2 day;
Comments
Post a Comment