如何将此 sql 转换为 codeigniters 活动记录格式
SELECT COUNT(*)
FROM(
SELECT DISTINCT component
FROM `multiple_sample_assay_abc`
WHERE labref = 'NDQA201303001'
)x
我试过这个功能,但它有sql错误
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);
}