how to get the second batch and 3rd batch in the same query result in oracle sql + yii framework?

Posted by sasori on Stack Overflow See other posts from Stack Overflow or by sasori
Published on 2012-11-06T03:46:20Z Indexed on 2012/11/06 5:00 UTC
Read the original article Hit count: 114

Filed under:
|
|

let' say i have 20 results in the sql query. if am gonna use the limit in the yii active record, I'll obviously get the first four from the result, but what if i wanna get the 2nd four and then 3rd four in the same query result ? how to query that via sql ?

e.g

        $criteria2 = new CDbCriteria();
        $criteria2->select = 'USERID, ADID ,ADTYPE, ADTITLE, ADDESC, PAGEVIEW, DISPPUBLISHDATE';
        $criteria2->addCondition("STATUS = 1");
        $criteria2->order = '"t".PAGEVIEW DESC,"t".PUBLISHDATE DESC';
        $criteria2->limit = 4;
        $criteria2->with = array('subcat','adimages');
        $result = $this->findAll($criteria2);
        return $result;

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle