Presto合并两列并输出为一

时间:2019-08-14 14:12:36

标签: presto

我正在尝试将两列预先合并在一起。

这是查询的一部分,必须以某种方式设置格式。

SELECT 'Display' AS channel, 
        DBM.dated, 
        DBM.market, 
        DBM.impressions, 
        DBM.clicks, 
        sum(DBM.amount_spent_EUR)+sum(DBm.platform_fee) as DBM.amount_spent_EUR
FROM 
(

SELECT
DATE_FORMAT(DATE_PARSE(date,'%Y/%m/%d'),'%Y-%m-%d') AS dated, 
trim(SPLIT_PART(insertion_order,'|',3)) AS market, 
sum(cast(impressions as double)) as impressions, 
sum(cast(clicks as double)) as clicks, 
sum(CAST(media_cost_advertiser_currency AS DOUBLE)*1.15) AS amount_spent_EUR,
sum(CAST(media_fee_1_adv_currency AS DOUBLE)*1.15) as platform_fee

FROM ralph_lauren_google_sheet_dbm_data_2  

WHERE dated <= {{days_ago 1}}

GROUP BY 1,2
)DBM 

错误如下:

  

查询20190814_125505_19433_rcrut失败:行1:144:无关输入   '。'期望{,',','EXCEPT','FROM','GROUP','HAVING',   'INTERSECT','LIMIT','ORDER','UNION','WHERE'}

错误是dbm.amount_spent_eur。本专栏必须这样发表。 我该如何解决?

1 个答案:

答案 0 :(得分:2)

在这种情况下,您可以使用双引号。

as "DBM.amount_spent_EUR"