BigQuery Numeric DateTime到字符串DateTime
我已经写了一个大Query的查询:
SELECT date_trunc(dd.created, week) AS week,
COUNT(DISTINCT dd.user) AS total,
COUNT(dd.upload) AS info
FROM
local.detail dd
LEFT JOIN local.list du ON dd.id = du.id
WHERE
regexp_extract(du.email, r '@(.+)') != 'gmail.com'
GROUP BY
date_trunc(dd.created, week);
输出:
周 | 总计 | 2020-02-02-02 |
---|---|---|
00:00:00 | 625 382 | 382 |
2020-03-22 00:00:00 | 1059 1059 | 329 |
我想要Week_Signup像这样的列数据格式(仅一个月和一天):
周 | 总 | 信息 |
---|---|---|
Feb 02 | 625 | 382 |
3月382 382 382 | 1059 | 329 |
我该如何写这个?
I have written a query in bigquery like below:
SELECT date_trunc(dd.created, week) AS week,
COUNT(DISTINCT dd.user) AS total,
COUNT(dd.upload) AS info
FROM
local.detail dd
LEFT JOIN local.list du ON dd.id = du.id
WHERE
regexp_extract(du.email, r '@(.+)') != 'gmail.com'
GROUP BY
date_trunc(dd.created, week);
Output:
week | total | info |
---|---|---|
2020-02-02 00:00:00 | 625 | 382 |
2020-03-22 00:00:00 | 1059 | 329 |
i want the week_signup column data format like this(just month and day):
week | total | info |
---|---|---|
Feb 02 | 625 | 382 |
Mar 03 | 1059 | 329 |
How can i write this in bigquery to get this??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 format_date_date 。
例如
format_date(“%a%d”,date_trunc(dd.Created_date,Week))
Use format_date for the same.
E.g.
FORMAT_DATE("%a %d", date_trunc(dd.created_date, week))