Dzień dobry, jestem zielony w tym temacie albo kod który mam powoduje, że głupieje.
Stworzyłem ranking, który pobiera dane z dwóch tabel. Z tabeli zwanej _verein pobiera id klubu, punkty, bramki itp zaś z tabeli _liga pobiera dane z kolumny land.
public function getTemplateParameters() {
$columns = array(
'C.id' => 'id',
'C.name' => 'name',
'L.land' => 'league_name',
'C.sa_punkte' => 'score',
'C.sa_tore' => 'goals',
'C.sa_gegentore' => 'goals_received',
'(C.sa_tore - C.sa_gegentore)' => 'goals_diff',
'C.sa_siege' => 'wins',
'C.sa_niederlagen' => 'defeats',
'C.sa_unentschieden' => 'draws',
'C.sa_spiele' => 'matches',
'C.nationalteam' => 'nationalteam',
'C.bild' => 'picture',
'U.id' => 'user_id',
'U.nick' => 'user_name',
'U.email' => 'user_email',
'U.picture' => 'user_picture'
);
$fromTable = $this->_websoccer->getConfig('db_prefix') . '_verein AS C';
$fromTable .= ' LEFT JOIN ' . $this->_websoccer->getConfig('db_prefix') . '_user AS U ON U.id = C.user_id';
$fromTable .= ' INNER JOIN ' . $this->_websoccer->getConfig('db_prefix') . '_liga AS L ON C.liga_id = L.id';
$whereCondition = 'nationalteam = \'0\' AND sa_punkte > 0 ORDER BY score DESC, goals_diff DESC, wins DESC, draws DESC, goals DESC, name ASC';
$result = $this->_db->querySelect($columns, $fromTable, $whereCondition);
while ($team = $result->fetch_array()) {
$teams[] = $team;
}
$result->free();
return array("teams" => $teams);
}
Taki jest kod wyjściowy.
W tym momencie pokazuje mi się lista wszystkich klubów, które nie są reprezentacją.
Jak zrobić aby punkty klubów, które mają taką samą wartość kolumny "land" sumowało?