【发布时间】:2023-01-17 23:05:37
【问题描述】:
此查询显示按星期几分组的计数操作。
select count(*) c,
date_part('dow', "updatedAt" at time zone 'Europe/Paris') dow
from "Action" date_part('dow', "updatedAt" at time zone 'Europe/Paris')
天数显示为数字。有没有办法将其显示为文本? PostgreSQL 有这样的功能吗?
【问题讨论】:
-
可以试试
select count(*) c, to_char(date_trunc('day', "updatedAt" at time zone 'Europe/Paris'), 'Day') dow -
使用 to_char() 和您喜欢的布局。通常这是在应用程序的表示层中完成的,而不是在数据库中
标签: sql postgresql