模糊列名称时间戳

时间:2013-03-30 13:39:52

标签: sqlite

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

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()列应与目标表相关,并且所有其他列都有别名,我不明白错误或问题是如何解决的?

0 个答案:

没有答案