MySQL User defined variable within Doctrine and Symfony

前端 未结 1 596
半阙折子戏
半阙折子戏 2020-12-18 06:16

I have the following Doctrine statement which works fine.

$query = $this->createQuery(\'r\')
            ->select(\'u.id, CONCAT(u.first_name, \" \", L         


        
相关标签:
1条回答
  • 2020-12-18 07:12

    if you are using MySQL, and no switches to other DBMS are foreseen, maybe you could try

    $query = $this->createQuery('r')
                ->select('COUNT(u.id) as rank, u.id, CONCAT(u.first_name, " ", LEFT(u.last_name,1)) as full_name, u.first_name, u.last_name, u.gender, r.run_time')
                ->innerJoin('r.ChallengeUser u')
                ->orderBy('run_time')
                ->execute(array(), Doctrine::HYDRATE_ARRAY);
    
    0 讨论(0)
提交回复
热议问题