标签: activerecord yii2
SELECT mksg_id, valid_from, price FROM (SELECT prices.* , MAX(valid_from) OVER (PARTITION BY mksg_id) max_date FROM prices) s WHERE valid_from = max_date
如何将其转换为ActiveRecord?谢谢。