设为首页 加入收藏

TOP

postgresql按日期范围查询
2015-11-21 01:31:23 来源: 作者: 【 】 浏览:0
Tags:postgresql 日期 范围 查询

按照日期范围查询有好几种方法,日期字段类型一般为:

Timestamp without timezone

方法一:

select * from user_info where create_date >= '2015-07-01' and create_date < '2015-08-15';

方法二:

select * from user_info where create_date between '2015-07-01' and '2015-08-15';

方法三:

select * from user_info where create_date >= '2015-07-01'::timestamp and create_date < '2015-08-15'::timestamp;

方法四:

select * from user_info where create_date between to_date('2015-07-01','YYYY-MM-DD') and to_date('2015-08-15','YYYY-MM-DD');
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇SQL中union,EXCEPT和INTERSECT使.. 下一篇Sqlite数据库解析以及恢复(一)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: