1
有人能爲我設置正確的語句嗎?SQL UPDATE的正確語法,其中要設置的值是SELECT
我試圖更新表rounds
一個新的領域,在表holes
平均場的地方rounds.id
存儲爲外鍵。
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
當然會感激這個教訓!
非常感謝!我絕對學到了新東西! – jerrygarciuh 2009-11-10 17:42:05