Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql DQL symfony/如何返回最后一个id_Sql_Symfony_Dql - Fatal编程技术网

Sql DQL symfony/如何返回最后一个id

Sql DQL symfony/如何返回最后一个id,sql,symfony,dql,Sql,Symfony,Dql,这是我的密码: return $this ->createQueryBuilder('b') ->innerJoin('b.visiteurs', 'v') ->select("count(v.id)") ->where('b.visiteDate IS NOT NULL') ->groupBy('b.visiteDate') ->orderBy('b.id', 'DESC') ->setMaxRe

这是我的密码:

return $this
    ->createQueryBuilder('b')
    ->innerJoin('b.visiteurs', 'v')
    ->select("count(v.id)")
    ->where('b.visiteDate IS NOT NULL')
    ->groupBy('b.visiteDate')
    ->orderBy('b.id', 'DESC')
    ->setMaxResults(1)
    ->getQuery()
    ->getSingleScalarResult();

我正在尝试按
visiteDate
统计我分组的访客数,并仅返回上次
visiteDate
I刷新的访客数。我试过使用
orderBY('b.id','DESC')
,但不起作用

“visitDate”的数据类型是什么?数据类型是DateTime我建议您进行断点筛选,我估计有两种可能性。如果您的字段类型有问题,一种可能是映射关系有问题您是否遇到了一些错误?如果有的话,贴在这里。