如何使用标准SQL 仅提取时间戳的小时数。
我已经尝试了一切,但没有任何功能有效。问题是我必须从一列中提取时间,该列的格式如下:2018-07-09T02:40:23.652Z
如果我只输入日期,它会起作用,但是如果我输入该列,则会出现以下错误:
Syntax error: Expected ")" but got identifier "searchIntention" at [4:32]
Run Code Online (Sandbox Code Playgroud)
按照下面的查询:
#standardSQL
select TOTAL, dia, hora FROM
(SELECT cast(replace(replace(searchIntention.createdDate,'T',' '),'Z','')as
DateTime) AS DIA,
FORMAT_DATETIME("%k", DATETIME searchIntention.createdDate) as HORA,
count(searchintention.id) as Total
from `searchs.searchs2016626`
GROUP BY DIA)
Run Code Online (Sandbox Code Playgroud)
请帮我。:(