-1

我只想将我的行数限制为 400,但它会使用“400,100”创建查询并导致问题。

这是我的代码:

$this->paginate = array('limit' => 400,
                        'order' => array('MantisBugTable.sort_order' => 'ASC'),
                        'group' => '`MantisBugTable`.`id`',
                        'joins' => array(
                                      array(
                                        'alias' => 'MantisLastReadTicketTable',
                                        'table' => 'mantis_last_read_ticket_table',
                                        'type' => 'LEFT',
                                        'conditions' => array('`MantisLastReadTicketTable`.`ticket_id` = `MantisBugTable`.`id`', '`MantisLastReadTicketTable`.`user_id` = '.$userAdminInfo['UserAdmin']['id'])
                                      ),
                                      array(
                                        'alias' => 'MantisBugnoteTable',
                                        'table' => 'mantis_bugnote_table',
                                        'type' => 'LEFT',
                                        'conditions' => '`MantisBugnoteTable`.`bug_id` = `MantisBugTable`.`id`'
                                      )
                                  ),
                       'fields' => array('MantisBugTable.*', 'MantisLastReadTicketTable.*', 'COALESCE(MAX(`MantisBugnoteTable`.`last_modified`), `MantisBugTable`.`last_updated`, NULL) AS MantisBugnoteTable__LastModified')
                      );

但它会吐出它的极限,最后还有一个“100”:

SELECT `MantisBugTable`.*, `MantisLastReadTicketTable`.*, COALESCE(MAX(`MantisBugnoteTable`.`last_modified`), `MantisBugTable`.`last_updated`, NULL) AS MantisBugnoteTable__LastModified FROM `mantis_bug_table` AS `MantisBugTable` LEFT JOIN `mantis_last_read_ticket_table` AS `MantisLastReadTicketTable` ON (`MantisLastReadTicketTable`.`ticket_id` = `MantisBugTable`.`id` AND `MantisLastReadTicketTable`.`user_id` = 101) LEFT JOIN `mantis_bugnote_table` AS `MantisBugnoteTable` ON (`MantisBugnoteTable`.`bug_id` = `MantisBugTable`.`id`)  WHERE `MantisBugTable`.`handler_id` = 0 AND (NOT (`MantisBugTable`.`category_id` IN (10, 12)) AND NOT (`MantisBugTable`.`status` IN (80, 90)))  GROUP BY `MantisBugTable`.`id`  ORDER BY `MantisBugTable`.`sort_order` ASC  LIMIT 400, 100

你认为为什么会这样?

我试过设置 'offset' => 0 但这没有用。

谢谢,安迪

4

1 回答 1

-3

没关系,不知怎的,我的饼干被划掉了。

于 2013-06-11T22:07:22.687 回答