i describe what i have and what want to receive here (cant paste link so paste all text):
i need this for my order/index.
now i receive this data via such SQL:
SELECT o.id, o.info, oh_status.update_time
FROM
tbl_order o
INNER JOIN
(
SELECT order_id,update_time FROM tbl_order_status WHERE (order_id,update_time) IN
(SELECT order_id, MAX(update_time) max_update_time FROM tbl_order_status GROUP BY order_id)
) oh_status
ON (o.id = oh_status.order_id)
order by oh_status.update_time desc
i want to know how make this via AR ?
i start learn yii and start work with AR and it is looks very nice when work with one table, but complicated when try to work with two or more tables.