sql查询数据并修改数据

UPDATE configuration_datapoints
SET attribute_flag = ''
WHERE
    attribute_flag = 'DCP'
AND (
    data_point_name = 'DCP2'
    OR data_point_name = 'DCP3'
)
AND device_info_id IN (#此为外键关联的configuration_deviceinfos表的id.
    SELECT
        id
    FROM
        configuration_deviceinfos
    WHERE
        station_id = 1
)

 

 

UPDATE configuration_datapoints
SET multi_factor = REPLACE (multi_factor, '1', '0.1')
WHERE
device_info_id IN (
SELECT
dev.id
FROM
configuration_deviceinfos dev
WHERE
dev.station_id = 77
)
AND data_point_name = "PVA电流"
AND STATUS = 1

你可能感兴趣的:(SQL)