DQL-类似于mysql LAST的函数


DQL - similar function to the mysql LAST

在mysql中,有一个函数last,它返回最后找到的值。我想在一个符号项目中获得与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);

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

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

mysql中没有这样的函数。它来自ms访问。您希望将order bylimit一起使用。如果没有order by,就不能保证从5行中得到相同的行。