我想从表中排除一个 id 但似乎没有得到这个工作。
这是一个从 2 个表中获取数据的 CodeIgniter 数据表。
我想从warehouse_id 2 中排除数据
function getdata()
{
$this->load->library('datatables');
$this->datatables->select("products.id as productid, image, code, name, size, color, type, gender, price, (CASE WHEN sum(warehouses_products.quantity) Is Null THEN 0 ELSE sum(warehouses_products.quantity) END) as totalQuantity");
$this->datatables->from('products');
$this->datatables->join('warehouses_products', 'products.id=warehouses_products.product_id', 'left');
$this->datatables->where('warehouses_products.warehouse_id !=', '2');
$this->datatables->group_by("productid");
echo $this->datatables->generate();
}
错误是:
Fatal error: Call to a member function num_rows() on a non-object in /system/database/DB_active_rec.php on line 990