0

我正在尝试将平滑的测量数据选择到另一个表中:

INSERT INTO data (channel_id, timestamp, value) 
SELECT 1 AS channel_id, m1.timestamp*1000 AS timestamp, -IFNULL((m3.generation + 2*m1.generation + m2.generation)/4.0, 0) AS value
FROM meterreading m1
LEFT JOIN meterreading m2 ON (m1.timestamp = m2.timestamp-300) 
LEFT JOIN meterreading m3 ON (m1.timestamp = m3.timestamp+300) 

这将导致

sqlite3.OperationalError: ambiguous column name: timestamp

一旦语句的 INSERT 部分被删除,错误就会消失。由于 INSERT() 列应该与目标表相关,并且所有其他列都是别名,我不明白错误或如何解决问题?

4

0 回答 0