Changed: Replace 'deviceid' with 'device_id' for the device_values table