【发布时间】:2015-07-31 04:38:06
【问题描述】:
这是我的活动记录查询!它不断给我错误 where 子句中的未知列:
public function getItemSale($start, $end = 9,$userid,$loc_id,$item)
{
$sql = "SELECT Name, sum(Qty) as total, sum(Price) as sale from itransfile where
SESSIONID = GETSESSIONID(?) && PayMode IN('CASH','Cheque')" ;
if(is_numeric($loc_id))
$sql .= " && location_id = " .$loc_id ;
else
$sql .= " && location_id IN(SELECT location_id FROM client_locations where client_id = " .$userid. ")";
if($item != 'All')
$sql .= " && Name = `{$item}`";
$sql .= " group by Name order by sale desc LIMIT ? OFFSET ?;";
$query = $this->db->query($sql, array(date("Y-m-d"),$end,(int)$start));
return $query->result_array();
}
【问题讨论】:
-
你的桌子是什么样子的?
标签: php codeigniter activerecord