在PGSQL中,可以使用以下方法对比昨天的日期:
SELECT *
FROM your_table
WHERE your_date_column = current_date - interval '1 day';
上面的查询语句可以在your_table表中找到日期为昨天的记录。首先,current_date
函数会返回当前日期,然后通过interval '1 day'
来减去一天得到昨天的日期。将该日期与your_date_column进行比较,即可找到日期为昨天的记录。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>