Something like that:
$myRows = MyTableQuery::create()-> addAsColumn('count', 'COUNT(name)')-> addGroupByColumn('count')-> addDescendingOrderByColumn('count')-> find();
I'm not sure about GROUP BY
- you might need an alias or override the COUNT
clause. Try it and see what works in the experiment :)
You really have to use IDE autocompletion to use Propel (and the doctrine, for that matter) - your queries will be much easier to build.
My usual answer would usually be similar to @ManseUK, i.e. based on the Criteria class, but this will be canceled when Propel 2 appears, so it's probably a good idea to prepare your code now.
source share