I have a mysql table as follows.
CREATE TABLE `events` (
`event_id` int(11) NOT NULL AUTO_INCREMENT,
`eventName` varchar(45) DEFAULT NULL,
`eventType` varchar(45) DEFAULT NULL,
`user_id` varchar(45) DEFAULT NULL,
`eventStartDate` date DEFAULT NULL,
`eventStartTime` time DEFAULT NULL,
`eventEndDate` date DEFAULT NULL,
`eventEndTime` time DEFAULT NULL,
`eventoptions` varchar(1000) DEFAULT NULL,
PRIMARY KEY (`event_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
I need to send an email three days before eventStartTime. I need query to get the event, I hope to through event get the user and send email. Can I do that using DATE_SUB(),
But how can I do that? I am very bad at sql.
I use Mysql connector Java.
Thank you!
This will give you all events which are 3 days from now.