How can i convert this sql to codeigniters active record format
SELECT COUNT(*)
FROM(
SELECT DISTINCT component
FROM `multiple_sample_assay_abc`
WHERE labref = 'NDQA201303001'
)x
I have tried this function but it has sql error
function getAssayMultipleCount($labref){
$this->db->count_all('*');
$this->db->from();
$this->db->distinct('component');
$this->db->from('multiple_sample_assay_abc');
$this->db->where('labref',$labref);
$query= $this->db->get();
return $result=$query->result();
//print_r($result);
}