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

Comments