I inherited MYSQL database that has lots of tables with data like
CREATE TABLE IF NOT EXISTS `ejl_registration` (
`id` int(11) NOT NULL auto_increment,
`team_id` int(11) default NULL,
`start_date` date default NULL,
`end_date` date default NULL,
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=88668 ;
start_date and end_date should have values like:
- 2007-1-5, 2007-12-31
- 2008-1-1, 2008-12-31
- 2009-1-15,2009-12-31
But some of those en_date fields are either NULL or 0000-00-00. Is there a ways to have single query to update all those invalid en_date fields and set their value to the end of the year equal to the year of start_date