我想從表中排除一個ID,但似乎沒有得到這個工作。從選擇mysql中排除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
[CI用戶指南](http://ellislab.com/codeigniter/user-guide/database/active_record.html#select)'$ this-> db-> where('name!= ',$ name);' –