谁能帮我将此 MySQL 语句转换为 MS SQL 以在 SQL 2008 R2 上运行?
SELECT UNIX_TIMESTAMP(summary.date) as epoch_date,
round(SUM(CASE WHEN meters.group != '' THEN kWh ELSE 0 END),2) as total,
round(SUM(CASE WHEN meters.group = 'eastern' THEN kWh ELSE 0 END),2) as eastern,
round(SUM(CASE WHEN meters.group = 'western' THEN kWh ELSE 0 END),2) as western,
round(SUM(CASE WHEN meters.group = 'central' THEN kWh ELSE 0 END),2) as central
FROM summary, meters
WHERE summary.webmeterID = meters.webmeterID
AND date BETWEEN
DATE_SUB(CURRENT_DATE, INTERVAL 3 YEAR)
AND DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY)
GROUP by date