Answer the question
In order to leave comments, you need to log in
What is wrong in this request?
Kohana ORM generates a request, but an error occurs during its execution, please tell me what is wrong with it?
Database_Exception [ 1064 ]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `order`.`author_id` = `oa`.`user_id`) AND `supplier_id` = '25' AND `status' at line 1 [ SELECT COUNT(`order`.`id`) AS `records_found` FROM `orders` AS `order` WHERE EXISTS (SELECT `order_archive` AS `oa` WHERE `order`.`author_id` = `oa`.`user_id`) AND `supplier_id` = '25' AND `status_id` <> 4 AND (`allow_group` = 'suppliers' OR `allow_group` = 'all') ]
$active_orders_count_all = ORM::factory('Order')
->where(null, 'EXISTS', DB::expr('(SELECT `order_archive` AS `oa` WHERE `order`.`author_id` = `oa`.`user_id`)'))
->and_where('supplier_id', '=', $this->user->id)
->and_where('status_id', '<>', 4)
->and_where_open()
->where('allow_group', '=', 'suppliers')
->or_where('allow_group', '=', 'all')
->and_where_close();
->count_all();
Answer the question
In order to leave comments, you need to log in
SELECT * FROM `order_archive` AS `oa` WHERE `order`.`author_id` = `oa`.`user_id`
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question