使用ORDER BY的ResultSetMappingBuilder查询问题

时间:2014-10-17 07:21:13

标签: php mysql sql symfony doctrine-orm

我有以下查询:

    $max = 3;
    $sql = "SELECT * 
            FROM `prospective_shop` ps
            WHERE  ps.`approached_by_user` IS NOT NULL 
            AND    ps.`userid` 
            NOT IN (
                SELECT s.userid
                FROM  `instagram_shop` s
            )
            ORDER BY ps.`approacheddate` ASC
            LIMIT $max
            ";

    $rsm = new ResultSetMappingBuilder($this->_em);
    $rsm->addRootEntityFromClassMetadata('App\MainBundle\Entity\ProspectiveShop', 'p'); 
    return $this->_em->createNativeQuery($sql, $rsm)->getResult();

当我尝试运行此查询时,该过程永远不会停止,花了很长时间,我认为出现了错误:

ORDER BY ps.`approacheddate` ASC

当我删除此LINE时一切正常。我的查询出了什么问题?

0 个答案:

没有答案