全系統每頁、每欄位數據需能核對不能有時間差
合併電站中 - 當日發電量、總發電量 (和電站總攬相同)
This commit is contained in:
parent
02cb87ae78
commit
86c8b47e37
@ -56,11 +56,11 @@ namespace SolarPower.Repository.Implement
|
||||
sql = $@"SELECT m.*,n.*,o.*,p.* FROM
|
||||
(
|
||||
SELECT
|
||||
SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh,
|
||||
SUM(TOTALCARBON) AS All_Carbon
|
||||
from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a
|
||||
LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP
|
||||
SUM(ps.Total_kwh) AS All_kwh,
|
||||
SUM(ps.total_money) AS All_money,
|
||||
SUM(ps.total_carbon) AS All_Carbon
|
||||
FROM power_station ps
|
||||
WHERE ps.Id IN @ids
|
||||
)
|
||||
AS m,
|
||||
(
|
||||
@ -117,11 +117,11 @@ namespace SolarPower.Repository.Implement
|
||||
sql = $@"SELECT m.*,n.*,o.*,p.* FROM
|
||||
(
|
||||
SELECT
|
||||
SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh,
|
||||
SUM(TOTALCARBON) AS All_Carbon
|
||||
from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a
|
||||
LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP
|
||||
SUM(ps.Total_kwh) AS All_kwh,
|
||||
SUM(ps.total_money) AS All_money,
|
||||
SUM(ps.total_carbon) AS All_Carbon
|
||||
FROM power_station ps
|
||||
WHERE ps.Id IN @ids
|
||||
)
|
||||
AS m,
|
||||
(
|
||||
@ -152,11 +152,11 @@ namespace SolarPower.Repository.Implement
|
||||
sql = $@"SELECT m.*,n.*,o.*,p.* FROM
|
||||
(
|
||||
SELECT
|
||||
SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh,
|
||||
SUM(TOTALCARBON) AS All_Carbon
|
||||
from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a
|
||||
LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP
|
||||
SUM(ps.Total_kwh) AS All_kwh,
|
||||
SUM(ps.total_money) AS All_money,
|
||||
SUM(ps.total_carbon) AS All_Carbon
|
||||
FROM power_station ps
|
||||
WHERE ps.Id IN @ids
|
||||
)
|
||||
AS m,
|
||||
(
|
||||
@ -189,12 +189,12 @@ namespace SolarPower.Repository.Implement
|
||||
case 3:
|
||||
sql = $@"SELECT m.*,n.*,o.*,p.* FROM
|
||||
(
|
||||
SELECT
|
||||
SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh,
|
||||
SUM(TOTALCARBON) AS All_Carbon
|
||||
from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a
|
||||
LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP
|
||||
SELECT
|
||||
SUM(ps.Total_kwh) AS All_kwh,
|
||||
SUM(ps.total_money) AS All_money,
|
||||
SUM(ps.total_carbon) AS All_Carbon
|
||||
FROM power_station ps
|
||||
WHERE ps.Id IN @ids
|
||||
)
|
||||
AS m,
|
||||
(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user