$this->db->select('SUM(status = In Stock)As In Stock,SUM(status = Allocated)AS Allocated,SUM(status = Decommission) as Decommission,SUM(status = In transit)AS In Transit');
// $this->db->from('assets');
$this->db->group_by("assettype,location");
$query = $this->db->get('assets');
在上面的查询中出现语法错误。 请帮助
答案 0 :(得分:0)
变化 $ this-> db-> select('SUM(status =“In Stock”)作为In_Stock,SUM(status =“Allocated”)AS已分配,SUM(status =“Decommission”)为Decommission,SUM(status = “在途中”)AS In_Transit');