UPDATE
ent_emodel_energy_data_quarter,
(SELECT
EMODEL_ENERGY_DATA_ID,
ent_emodel_energy_data_quarter.EMODEL_ENERGY_ID AS EMODEL_ENERGY_ID,
DATA_TIME,
(SELECT
SUM(VALUE)
FROM
ent_emodel_energy_data_month
WHERE (
DATA_TIME = ent_emodel_energy_data_quarter.DATA_TIME
OR ent_emodel_energy_data_quarter.DATA_TIME BETWEEN '2015-08-01 00:00:00'
AND '2015-08-31 23:59:59'
OR ent_emodel_energy_data_quarter.DATA_TIME BETWEEN '2015-09-01 00:00:00'
AND '2015-09-30 23:59:59'
AND EMODEL_ENERGY_ID = ent_emodel_energy_data_quarter.EMODEL_ENERGY_ID
)) AS VALUE
FROM
ent_emodel_energy_data_quarter
INNER JOIN ent_emodel_energy
ON ent_emodel_energy_data_quarter.EMODEL_ENERGY_ID = ent_emodel_energy.EMODEL_ENERGY_ID
WHERE DATA_TIME = '2015-07-01'
AND IS_MANUAL_INPUT = 1
AND PERIOD_ID <= 8
AND IS_ENABLE = 1) AS changedata
SET
ent_emodel_energy_data_quarter.VALUE = changedata.VALUE
WHERE ent_emodel_energy_data_quarter.EMODEL_ENERGY_DATA_ID = changedata.EMODEL_ENERGY_DATA_ID
MySql为什么可以跑起来,SqlServer直接挂掉了。。。报错[Err] 42000 - [SQL Server]“,”附近有语法错误。
42000 - [SQL Server]关键字 'AS' 附近有语法错误。