I have a schema like goods_quality( gqualityId , GoodsId , UnitId , SupplierId, quality )

I want to get sum of quality gourp by SupplierId and GoodsId , so I do as this:

                                    ->having("SUM(quality) > 0")

but I got exception

Phalcon\Mvc\Model\Exception: Scanning error before 'SUM(quality) > 0...' when parsing: SELECT SUM(quality), * FROM [Pkerp\Models\GoodsQuality] GROUP BY [SUM(quality) > 0]

Why the group by field form the having() method ?

and I also try to use modelManager it's just work like this:

                            ->having("SUM(SG.quality) > 0")

I don't know what's different?