本文介绍了您如何在 postgres 中选择日期范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 postgres 数据库中有一个时间戳字段.我想选择上个月内发生的所有日期.所以像 select * from table where timestamp > (current timestamp - 1 month) 之类的.

I have a timestamp field in a postgres database. I would like to select all dates that have happened within the last month. So something like select * from table where timestamp > (current timestamp - 1 month).

推荐答案

select * from table where timestamp > now() - interval '1 month'

这篇关于您如何在 postgres 中选择日期范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 08:27