Menggunakan Raw SQL di Propel
public static function getJumlahSkor($performa_id="") {
$connection = Propel::getConnection();
$query = "SELECT SUM(".SupervisiSkorDetailPeer::SKOR.") AS jumlah
FROM ".SupervisiSkorDetailPeer::TABLE_NAME.", ".SupervisiPerformaDetailPeer::TABLE_NAME."
WHERE ".SupervisiSkorDetailPeer::SUPERVISI_PERFORMA_DETAIL_ID."=".SupervisiPerformaDetailPeer::ID."
AND ".SupervisiPerformaDetailPeer::SUPERVISI_PERFORMA_ID."=?;";
$statement = $connection->prepareStatement($query);
$statement->setString(1, $performa_id);
$resultset = $statement->executeQuery();
$resultset->next();
$jumlah = $resultset->getInt('jumlah');
return $jumlah ;
}
Referensi
Using Raw SQL Queries, http://symfony.com/legacy/doc/book/1_1/en/08-Inside-the-Model-Layer#chapter_08_sub_using_raw_sql_queries
PROPEL QUERIES USING CUSTOM SQL, PEER CLASSES, AND CRITERION OBJECTS, http://stereointeractive.com/blog/2007/06/12/propel-queries-using-custom-sql-peer-classes-and-criterion-objects/