将字符串添加到查询结果
我有以下查询:
select point_delivery_number, bin(time,1h) as time , AVG(self_coverage) as self_coverage , AVG(generation) as generation , AVG(consumption) as consumption
from "energy_datapoints"."formatted_group_raw"
GROUP BY point_delivery_number, bin(time, 1h)
ORDER BY time desc
结果如下:
我想在指示那是UTC时间格式
结果的时间中添加z
应该是:
AT..... | 2021-05-31 21:00:00.00000Z | ... | ... | ...
我尝试使用Concat
CONCAT(bin(time,1h), 'Z') as time
说:
行1:31:意外参数(Timestamp,varchar(1))功能 'concat'
可能有更好的方法吗?
I have the following query:
select point_delivery_number, bin(time,1h) as time , AVG(self_coverage) as self_coverage , AVG(generation) as generation , AVG(consumption) as consumption
from "energy_datapoints"."formatted_group_raw"
GROUP BY point_delivery_number, bin(time, 1h)
ORDER BY time desc
The result is following:
I want to add an Z
to the time to indicate thats an UTC time format
Result should be then:
AT..... | 2021-05-31 21:00:00.00000Z | ... | ... | ...
I tried to use CONCAT
CONCAT(bin(time,1h), 'Z') as time
It says:
line 1:31: Unexpected parameters (timestamp, varchar(1)) for function
'CONCAT'
Is there maybe an better way of doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个适合您格式的示例:
用您的时间列替换
getutcdate()
。Here is an example with the right formatting for you:
Replace the
GetUtcDate()
with your time column.