F
Filamentβ€’9mo ago
pathogen

Getting SUM of related table column not working

Hi all, I'm trying to get the SUM of the values on a related table column, and although I'm not getting any errors, this doesn't work with my code. The two COUNT columns work, but the two SUM columns don't. Can someone point out what I'm doing wrong? Many thanks.
No description
No description
Solution:
Found the documentation and trips_sum_distance works! Thanks for pointing me in the right direction.
Jump to solution
5 Replies
Dennis Koch
Dennis Kochβ€’9mo ago
The name is probably distance_sum not total_miles
pathogen
pathogenOPβ€’9mo ago
Thanks Dennis. Just tried that and still no luck.
Dennis Koch
Dennis Kochβ€’9mo ago
Is it trips_sum? then. It follows Laravels convention
pathogen
pathogenOPβ€’9mo ago
No, That doesn't work either. Tried trips.distance_sum too, and that doesn't work. Really scratching my head! πŸ™‚
Solution
pathogen
pathogenβ€’9mo ago
Found the documentation and trips_sum_distance works! Thanks for pointing me in the right direction.
Want results from more Discord servers?
Add your server