mardi 27 juin 2017

Laravel SQL how to add table fields value [duplicate]

This question already has an answer here:

I'm trying to get the sum of two team score but it returns null.

DB::table('team_competition_statistics')
->select([
    DB::raw('SUM(sGames) AS GP'),
    DB::raw('SUM(sPointsAverage) as AVGP'),
    DB::raw('SUM(sAssistsAverage) as AVGA'),
    DB::raw('SUM(sReboundsTotalAverage) as AVGR'),
    DB::raw('SUM(sStealsAverage) as AVGS'),
    DB::raw('SUM(sBlocksAverage) as AVGB')
])
->where('competitionId', $competitionId)
->where('periodNumber', 0)
->where('teamId', $id1)
->where('teamId', $id2)
->get();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2tirIOP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire