Sql 合并日期、点击次数、小时数和;四分之一场

Sql 合并日期、点击次数、小时数和;四分之一场,sql,google-analytics,google-bigquery,Sql,Google Analytics,Google Bigquery,我想将日期、hits.hour和hits.minute字段合并到一个日期字段中,以便Tableau能够轻松地读取该字段进行可视化 此时,日期是字符串,hits.hour和hits.minute是整数 最后,日期应该是YYYY-MM-DD&hh:MM Atm我将日期转换成字符串,但我现在不知道如何组合字段,或者通常不知道第一步是否正确 最好的, 帕斯卡 您只需要连接选定的值 SELECT fullVisitorId, visitId, CAST(date as strin

我想将日期、hits.hour和hits.minute字段合并到一个日期字段中,以便Tableau能够轻松地读取该字段进行可视化

此时,日期是字符串,hits.hour和hits.minute是整数

最后,日期应该是YYYY-MM-DD&hh:MM

Atm我将日期转换成字符串,但我现在不知道如何组合字段,或者通常不知道第一步是否正确

最好的, 帕斯卡


您只需要连接选定的值

SELECT 
    fullVisitorId,
    visitId,
    CAST(date as string) +' & ' + CAST (hits.hour as string) + ':' + CAST (hits.minute as string) AS datetime,
    totals.transactions ,
    hits.item.productName,
FROM [X.ga_sessions_20180221] 
WHERE 
    hits.hitNumber =1
GROUP BY 
  fullVisitorId, visitId, date, hour, minute, hits.item.productName, totals.transactions
SELECT 
    fullVisitorId,
    visitId,
    CAST(date as string) +' & ' + CAST (hits.hour as string) + ':' + CAST (hits.minute as string) AS datetime,
    totals.transactions ,
    hits.item.productName,
FROM [X.ga_sessions_20180221] 
WHERE 
    hits.hitNumber =1
GROUP BY 
  fullVisitorId, visitId, date, hour, minute, hits.item.productName, totals.transactions