我有2個表,「位置」和「發生」。事件存儲事件,具有creatorId和時間戳。我試圖從位置表中爲發生時間戳5分鐘內的所有時間戳計算平均緯度,並將其放置在發生緯度列中。從mysql中的子查詢中的更新表訪問列表
我已經試過以下,並得到一個「未知列‘where子句’occurrence.creatorId「。
update occurrence set latitude = (
select avg(latitude) from (
select * from location where (
location.creatorId=occurrence.creatorId
and location.timestamp<occurrence.timestamp+interval 5 minute
and location.timestamp>occurrence.timestamp-interval 5 minute
)
) as test
);
我懷疑是我想寫這太像一個Java 。程序有人可以幫助我的大腦變得更加的MySQL指明分數
感謝 巴格
工作就像一個魅力(雖然我去掉了「從發生○」因爲這是給我的悲傷「)。而在highsight,這是相當簡單的。這就是我得到的編碼過去我的就寢時間。謝謝。 – buggaby