select * FROM tb_message_news WHERE f_auto_pub_time BETWEEN to_date((now()- interval '1 year')::text,'yyyy-MM-dd') and to_date(now()::text,'yyyy-MM-dd')
Postgresql中to_date()函数使用问题_迷途中的小码农的博客-优快云博客_postgresql to_date
本文介绍了在PostgreSQL数据库中,如何使用to_date函数结合BETWEEN操作符来查询过去一年、一月或一周的数据。主要涉及的时间函数有now()、interval以及日期格式转换。
select * FROM tb_message_news WHERE f_auto_pub_time BETWEEN to_date((now()- interval '1 year')::text,'yyyy-MM-dd') and to_date(now()::text,'yyyy-MM-dd')
Postgresql中to_date()函数使用问题_迷途中的小码农的博客-优快云博客_postgresql to_date
1408
605
2万+

被折叠的 条评论
为什么被折叠?