I need to fetch data between two dates but its not working.

my table-

[![enter image description here](https://i.stack.imgur.com/nquWM.png)](https://i.stack.imgur.com/nquWM.png)

from date and to date parameters are - 

```
$from_date = '2016-12';
$to_date = '2017-03';

```

table column **Month** type is **varchar**

```
$this->db->select('*', FAlSE);
$this->db->where('t.Flag', '0');
$this->db->where('tpd.Status', $status);
$this->db->where("STR_TO_DATE(tpd.Month, '%Y-%m') >=", date($from_date));
$this->db->where("STR_TO_DATE(tpd.Month, '%Y-%m') <=", date($to_date));
$this->db->from('test_periodicity_details tpd');
$this->db->join('test t', 'tpd.Test_Id=t.Test_Id');
$this->db->join('school_information si', 't.School_Id=si.School_Id', 'left');
$this->db->join('test_status ss', 'tpd.Status=ss.Test_Status_Id', 'left');
echo $this->db->get_compiled_select();
$query = $this->db->get();
if ($query->num_rows() > 0){
    return $query->result();
}
else {
    return false;
}

```