我不知道如何使用 DbFinderPlugin 1.2.2 与 Symfony 和 Propel 编写以下查询:
SELECT species, COUNT(*) FROM Bird GROUP BY species;
Here is the DbFinderPlugin page
我对这个插件相当陌生,到目前为止我确实很喜欢它,但这个查询到目前为止一直困扰着我。
最佳答案
我不是 DBFinder 的专家,但看起来以下应该可行
$result = DbFinder::from('Bird')->
groupBy('species')->
select(array('species', 'count(*) cnt'))->
find();
编辑更改代码
关于mysql - 如何使用 Symfony 插件 DbFinderPlugin 制定查询以按列分组进行计数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/930902/