Categories
Mastering Development

How to count how many consecutive days a user is tagged as orange in MYSQL?

I would like to know how to count how many consecutive days up to today a user has been tagged as orange. I have the following CREATE TABLE `survey_daily` ( `id` int(11) NOT NULL, `user_id` varchar(30) NOT NULL, `color` varchar(10) NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `survey_daily` […]