我有这个过滤器添加
$subQuery = $query->createSubquery()
->select ('ps.id')
->from('Person ps')
->innerJoin('ps.JoomlaUser ju')
->innerJoin('ju.OrderList o')
->innerJoin('o.ItemList oi')
->whereIn ('oi.product_id',$value);
$subSubQuery = $subQuery->createSubquery()
->select('oh.order_id')
->from ('jos_vm_order_history oh')
->addWhere ('oh.order_status_code=?','C')
->addWhere ('oh.order_id=o.order_id') //<-- this doesn't work
->orderBy ('oh.date_added desc')
->limit(1);
$subQuery->addWhere('exists (' . $subSubQuery->getDql() . ')');
$query->addWhere('person_id in (' . $subQuery->getDql() . ')');
我需要将子查询与联接查询中的表关联起来。当我执行此操作时,我得到了
Column not found: 1054 Unknown column 'o.order_id' in 'where clause'
如何获取最终查询中使用的“OrderList”关系的查询别名?