关于这个 问题 ,我想创建一个索引以返回与此查询相同的输出。
以下内容可以索引,但会返回带有时间戳的日期,这不是我想要的。最初的回答:
--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
这个索引会是什么? - mapping domdate
- mapping dom