public function getProduct1($sp_id){
$this->db->select('*');
$this->db->from('product');
$this->db->where('pd_supplier',$sp_id);
$this->db->where('pd_status',1);
$this->db->join('stock','product.pd_code=stock.stock_product_id');
$this->db->group_by('stock.stock_product_id');
$this->db->where('stock.stock_qty < product.pd_min');
$this->db->select_max('stock.stock_id');
$this->db->order_by('stock.stock_id', 'desc');
$query = $this->db->get();
$row = $query->result();
return $row;
}
$ this-> db-> where('stock.stock_qty
此代码仅检查产品表中产品数量表中库存表中最后输入的数量