Displaying about to expire items

I’m displaying Expired Items using this (codeigniter 3)

$qs6="SELECT a.item_name,a.item_code,b.category_name,a.expire_date from db_items as a,db_category as b where b.id=a.category_id and a.expire_date<='".date("Y-m-d")."' and a.status=1 limit 10";
$q6=$this->db->query($qs6);

if($q6->num_rows()>0){
  $i=1;
  foreach ($q6->result() as $row){
    echo "<tr>";
    echo "<td>".$i++."</td>";
    echo "<td>".$row->item_name."</td>";
    echo "<td>".$row->category_name."</td>";
    echo "<td>".show_date($row->expire_date)."</td>";
    echo "</tr>";
  }
}

I want to display another table showing about to expire items 4 months before expiry. How should i display it. Please Help.