Hi, I'm trying to update a field in one table, from the sum of another field, in another table.
company_tbl (PRIMARY, companySize, companyName) location_tbl (PRIMARY, companyID, locationSize, locationName)
The two tables link by company_tbl.PRIMARY = location_tbl.companyID
update company_tbl comp, location_tbl loc
set companySize = sum(locationSize)
where comp.PRIMARY = loc.companyID
I'm getting an error of 'invalid use of group function'
A company can have multiple locations
Is what I want to do possible? I want to take the sum of locations, that belong to a specific company, and update the companySize with the sum.
Thanks!