0

在mysql中,有一个函数last,它返回最后找到的值。我想在 symfony 项目中使用 DQL。这是否可能。

即:我的桌子上有 10 件物品。有了我的位置,我得到了其中的 5 个,但我想得到这 5 个中的最后一个:

$lastPaperQB = $this->createQueryBuilder( 'p' )
    ->select('LAST(p)')
    ->where("p.conference_id = :c AND p.section_id = :s")
    ->setParameter('c', $conference_id)
    ->setParameter('s', $section_id);

但问题是 LAST 在 DQL 中不存在:

[Syntax Error] line 0, col 7: Error: Expected known function, got 'LAST' 
4

1 回答 1

1

mysql中没有这个功能。它来自 ms 访问。您想order bylimit. 如果没有order by您,则不能保证从 5 行中获得相同的行。

于 2013-08-27T13:14:12.067 回答