문제

데이터베이스에 의해 중간 행을 가져오고 싶습니다.

지난 10 행에서와 마찬가지로 한계를 사용합니다.

    return Doctrine_Query::create()
                ->select('v.*')
                ->from('Video v')                   
                ->where("v.community_id='$community_id' AND v.user_id='$user_id' AND v.published='$published'")
                ->orderBy('v.id DESC')
                ->limit(10)
                ->execute();        

하지만 110-120 행을 원한다면 어떨까요? 아무도 나에게 그것에 대해 말할 수 있습니까? 이런 종류의 쿼리를 교리로 작성하는 방법

도움이 되었습니까?

해결책 4

오프셋 절 ...CHK 디스

다른 팁

사용 오프셋() 절.

~할 수 있었다 a Doctrine_Pager

$page = 10;
$limit = 10;
$query = Doctrine_Query::create()
        ->select('t.*')
        ->from('SomeTable t')

$pager = new Doctrine_Pager(
    $query,
    $page,
    $limit
);

$rows = $pager->execute();

열 110-120 행의 경우 원합니다

LIMIT 109, 10
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top