下面是mysql查询。

UPDATE data_records
  INNER JOIN doors
  ON (sensors.gateway_id = doors.id)
  INNER JOIN data_records
  ON (data_records.sensor_id = sensors.id)
SET data_records.value=1
WHERE doors.addr='FFA'

我不知道是什么导致了这个错误。我的数据库中显然有数据记录表。

最佳答案

您不是连接传感器而是两次数据记录

UPDATE data_records
INNER JOIN doors   ON (sensors.gateway_id = doors.id)
INNER JOIN sensors ON (data_records.sensor_id = sensors.id)
SET data_records.value=1
WHERE doors.addr='FFA'

10-05 19:32