|
是想执行这样语句sql
$sql = select count(*) from goods_stock_info where goods_id = 13 and goods_intact_num > 0 or goods_return_num >0 or goods_damage_num >0;
用CI里面的方法对应写
$this->db->select("*");
$this->db->from("goods_stock_info");
$this->db->or_where(array('goods_intact_num > '=>0,'goods_return_num >'=>0,'goods_damage_num >'=>0));
$this->db->where('goods_id',$goods_id);
$query = $this->db->count_all_results();
难道这样不对?反正执行的结果是不对。
|
|