I’m using Oracle 11g for this so LIMIT doesn’t exist. And I’m not sure how I’d write the following query into Active Record
Yii::$app->db->createCommand("
SELECT FIELD_ID,
FIELD_VALUE, chr (13), ''), chr (10), ' ')) as FIELD_VALUE
FROM PROCESS_EXTRACTION T1
WHERE (PROCESS_ID = :PROCESS_ID)
AND CREATED_AT = (
SELECT MAX(T2.CREATED_AT)
FROM PROCESS_EXTRACTION T2
WHERE T2.PROCESS_ID = T1.PROCESS_ID
AND T2.FIELD_ID = T1.FIELD_ID
)
ORDER BY T1.ID ASC")
->bindValue(':PROCESS_ID', $id)
->queryAll();
As far as Oracle 11g and LIMIT a few years back I wrote one for an older version of sql server. Oracle is similar. Not at that computer now, but will try to post tomorrow. Of course newer versions you don’t have to code your own, it’s now built in.
Meanwhile search for limit and offset equivalent in oracle, I am sure you will find many examples. The trick is to make it a reusable class that can be called.