Answer the question
In order to leave comments, you need to log in
How to execute a subquery in ORM?
There are tables:
orders:
id, author_id, consumer_id, supplier_id, manager_id, status_id, created
orders_archive
id, order_id, user_id
,
created which were created by the current user, and which were added / not added to the archive (by the same user)
$orders = ORM::factory('Order')
->where('author_id', '=', $this->user->id)
->and_where(?)
Answer the question
In order to leave comments, you need to log in
->where(null, 'EXISTS', DB::expr('(SELECT * FROM `order_archive` AS `oa` WHERE `oa`.`order_id` = `order`.`id` AND ...)'))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question