I need to get same result which was explained in below query, but i need to do in mysql.
Total of orders open on a given date for each date in a date range
Appreciate for the help.
This is what I tried but it does not return required output:
CREATE TABLE tracking(id INT(10), open_date TIMESTAMP, close_date TIMESTAMP, severity VARCHAR(10));
INSERT INTO tracking VALUES
(1,'2016-01-01','2016-01-02', '1'),(2,'2016-01-01','2016-01-03', '2'),
(3,'2015-12-31','2016-01-03', '2'),
(4,'2015-12-31','2016-01-04', '1'),
(5,'2015-01-02','2016-01-04', '1');
SELECT COUNT(*), tr.open_date FROMtrackingtr
LEFT JOIN (
SELECT open_date FROM tracking WHERE 1=1) t
ON tr.open_date=t.open_dateclose_date
AND DATE(tr.open_date) <= '2015-12-30' AND (DATE(tr.) IS NULL OR DATE( tr.close_date)>= '2016-01-04')
GROUP BY tr.open_date
ORDER BY tr.open_date` ASC