Simplifying Queries: Using sum, count, etc in Propel 1.3

My old post handled Propel 1.2.

This is the way to do it in Propel 1.3

1
2
3
4
5
6
7
    $c = new Criteria();
    $c->add(FavoriteDatePeer::EVENTDATAPROPOSAL_ID, $this->getId());
    $c->addSelectColumn("SUM(".FavoriteDatePeer::SCORE.") as rank");
 
    $stmt = FavoriteDatePeer::doSelectStmt($c);
    $row = $stmt->fetch();
    return $row['rank'];
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response

August 21, 2009
Vadim

Thanks man, so shortly, so easy.