【发布时间】:2019-04-18 17:50:49
【问题描述】:
与此question 相关。我想创建一个返回与此查询相同的输出的索引;
--takes 2005-10-12
select date_trunc('month',table_withdates.dateoftransfer::date)::Date
from table_withdates;
--returns 2005-10-01
下面将索引但返回的时间戳添加到日期,这不是我想要的。
create index on table_withdates (date_trunc('month', dateoftransfer::timestamp));
--returns 2005-10-01 00:00:00
是否可以创建一个以该格式返回没有时间戳的日期的索引
【问题讨论】:
-
谢谢,但是当我运行
select date_trunc('month',table_withdates.dateoftransfer::date) from table_withdates;时它返回2005-10-01 00:00:00+01会是索引吗? -
转移日期是
date