Every derived table must have its own alias
作者:互联网
派生出来的表必须取别名
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
标签:own,exposureMarketcap,derived,alias,SELECT,marketcap,new,id,coinId 来源: https://blog.csdn.net/rabita0818/article/details/120312168