Hi folks
Can someone set me straight on the correct syntax for this statement?
I am trying to update a new field in table rounds
with an average of a field in table holes
where rounds.id
is stored as a foreign key.
UPDATE `rounds` SET drivingDistance_avg_per_hole = SELECT SUM(holes.drivingDistance)/COUNT(holes.drivingDistance) as avg FROM `holes`, `rounds` WHERE holes.drivingDistance != '' AND holes.round = rounds.id
Sure would appreciate the lesson!
TIA
JG