派生出来的表必须取别名
SELECT
sum( a.exposureMarketcapDiff )
FROM
(
SELECT
new.id,
new.coinId,
ifnull( new.exposureMarketcap, 0 ) - ifnull( old.exposureMarketcap, 0 ) AS exposureMarketcapDiff
FROM
( SELECT id, coin_id AS coinId, exposure_marketcap AS exposureMarketcap FROM reconcile_marketcap WHERE period_number = ( 3 ) ) new
LEFT JOIN ( SELECT id, coin_id AS coinId, exposure_marketcap AS exposureMarketcap FROM reconcile_marketcap WHERE period_number = ( 3-1 ) ) old ON new.coinId = old.coinId
) a