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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -