我想结合日期,hits.hour&将一个日期字段命中一个日期字段,可以通过Tableau轻松读取以进行可视化。
目前日期是一个字符串,而hits.hour& hits.minute是整数。
最后日期应该像YYYY-MM-DD& HH:毫米
Atm我将日期转换为字符串,但我现在不知道如何组合字段,或者通常如果第一步是正确的。
最佳, 帕斯卡
SELECT
fullVisitorId,
visitId,
date,
CAST (hits.hour as string) AS hour,
CAST (hits.minute as string) AS minute,
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
答案 0 :(得分:1)
您只需要连接选定的值
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