a_h*_*ame 97
假设你的意思是timestamp因为datetimePostgres中没有
将时间戳列转换为日期,这将删除时间部分:
select *
from the_table
where the_timestamp_column::date = date '2015-07-15';
Run Code Online (Sandbox Code Playgroud)
这将从7月15日返回所有行.
请注意,上面不会使用索引the_timestamp_column.如果性能至关重要,则需要在该表达式上创建索引或使用范围条件:
select *
from the_table
where the_timestamp_column >= timestamp '2015-07-15 00:00:00'
and the_timestamp_column < timestamp '2015-07-16 00:00:00';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
75698 次 |
| 最近记录: |