We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

GROUP BY count?

I am having trouble grouping by the row count when using find() instead of count().

$players = self::find([
        'winnerId IS NOT NULL AND completed IS NOT NULL AND completed > :date:',
        'bind' => [
            'date' => new \Phalcon\Db\RawValue('DATE_SUB(NOW(), INTERVAL 1 MONTH)')
        ],
        'group' => 'winnerId',
        'order' => 'rowcount'
]);

Where does the rowcount value come from? I dont see any alias for it.

Also, the RawValue will pass that bind in as a string converted to date, not an SQL literal. You should set up a dialect to use INTERVAL (and you wont need to bind it, just copy that to the condition). https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Db/Dialect/MysqlExtended.php