$sql = "SELECT
sum(case when status = 'D' then 1 else 0 end) AS Draft,
sum(case when status = 'L' then 1 else 0 end) AS Let,
id
FROM `crm_listings`
WHERE added_date BETWEEN '" . $st_date . "' AND '".$end_date."'
ORDER BY `added_date` DESC";
$response = count($this->db->query($sql));
echo $response;
या
echo $response->num_rows();