我需要你的帮助。我有这个 SQL 查询:
SELECT * , COUNT( * ) AS count FROM mytable GROUP BY email ORDER BY id DESC LIMIT 0 , 30
但我想在 Symfony2 中使用 Doctrine 和 createQueryBuilder() 来执行此操作。我试试这个,但没有奏效:
$db = $this->createQueryBuilder('s');
$db->andWhere('COUNT( * ) AS count');
$db->groupBy('s.email');
$db->orderBy('s.id', 'DESC');
你能帮我吗 ?谢谢 :)