Reputation: 15490
tried this query for entry a two day older date
INSERT INTO `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'
Upvotes: 0
Views: 574
Reputation: 172428
Try this:
INSERT INTO `subject`(`id` ,`marks` ,`entry`)
SELECT '12121', '12', CURRENT_DATE() - interval 2 day;
Upvotes: 2
Reputation: 1269753
You are inserting a string into a date column. The string gets converted to a number with a value of 0
. Instead, try this:
INSERT INTO subject(id, marks, entry)
SELECT '12121', '12', CURRENT_DATE() - interval 2 day;
Upvotes: 2