Created
June 15, 2017 00:09
-
-
Save tippexs/d7232892d18312c97e1eed42e73cc2c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$MMV = TableRegistry::get('Monthlyvalues'); | |
$query = $MMV->find()->contain(['Facilities']); | |
$result = $query->select(['sum_vegi' => $query->func()->sum('Monthlyvalues.vegi_val'), | |
'sum_mos' => $query->func()->sum('Monthlyvalues.mos_val'), | |
'sum_ges' => $query->func()->sum('Monthlyvalues.nor_val'), | |
'Facilities.colorcode', 'Facilities.tour_id', 'Facilities.facility_type' | |
]) | |
->where(['Monthlyvalues.year' => $year, 'Monthlyvalues.month' => $month, | |
'Monthlyvalues.day' => $day, 'Monthlyvalues.is_visible' => 'X', 'Facilities.tour_id IS NOT' => null]) | |
->group(['Facilities.facility_type', 'Facilities.colorcode'])->toArray(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment