title: How using where and group by for MySql
body: <p>I have a table in my database:</p>
  
  <pre><code>CREATE TABLE `yapial` (
    `user_id` int(11) NOT NULL,
    `username` varchar(255) DEFAULT NULL,
    `first_name` varchar(50) DEFAULT NULL,
    `last_name` varchar(50) DEFAULT NULL,
    `gender` varchar(10) DEFAULT NULL,
    `password` varchar(50) DEFAULT NULL,
    `status` tinyint(10) DEFAULT NULL,
    `date` datetime NOT NULL
  ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  </code></pre>
  
  <p><strong>status</strong> and <strong>date</strong> columns Index. I run sql code: </p>
  
  <pre><code>select status, count(*) from user_details group by status
  </code></pre>
  
  <p>and success running 0.34ms. But I want to add a date restriction => </p>
  
  <pre><code>select date, status, count(*) from user_details 
  where date between '2017-01-25 18:13:50' and '2017-01-29 18:13:50'
  group by status
  </code></pre>
  
  <p>Success running 6.52s. The time limit is too high. I want to reduce time running. How should I improve this?</p>