How to select randomly with doctrine

前端 未结 13 1010
耶瑟儿~
耶瑟儿~ 2020-11-27 20:21

Here is how I query my database for some words

$query = $qb->select(\'w\')
    ->from(\'DbEntities\\Entity\\Word\', \'w\')
    ->where(\'w.indiction         


        
13条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 20:28

    First get the MAX value from DB table & then use this as offset in PHP i.e $offset = mt_rand(1, $maxId)

提交回复
热议问题