sql - 如何获取今天午夜到昨天午夜的数据
问题描述
我正在寻找从今天午夜到昨天午夜的数据。如果今天的日期“2020-06-10 03:20:25”。我想在“2020-06-09 00:00:00”到“2020-06-10 00:00:00”之间创建
解决方案
假设createdate
是一timestamp
列:
where createdate >= date_trunc('day', current_timestamp) - interval '1 day'
and createdate < date_trunc('day', current_timestamp) + interval '1 day';
推荐阅读
- azure-active-directory - WVD 混合 AD 环境 AAD 和本地 AD
- kentico - 在 Kentico 中将数据填充回表单
- c# - 我的程序没有在我的 excel 中插入“00”
- javascript - 使用画布将文本转换为图像显示长文本
- javascript - Django 在 Django 表单中修改 FileField 输入按钮和标签
- javascript - 如何修复安装“react-router-dom”时出错?
- r - 如何从R中的给定字符串中识别字符串中重复次数最多的字符
- php - Wordpress - 更新设置字段时是否触发事件?
- angularjs - Angular 子网址未在托管时打开
- scala - scala中的嵌套案例