数据库名称:POSTGRESQL
数据库版本:8.2
内容/问题描述:
相合并两个字段(日期+时间)同时查寻,目前做法如下
date与time字段 型态为 字串(text)
date 格式 20170201
time 格式 01:01:01
select * from table where date||' '||time between '20170201 01:01:01' and '20170211 10:10:10'
查寻结果有达到我的需求,但是我想说转成时间型态来做,应该比较正确
如果用 select * from table where date(date) between date('20170101') and date('20170211')
这样是没有问题,但 date只取日期判断,无法包含时间
不知道要怎么做,才可以达到 用日期+时间来做资料筛选,请大大们教导一下...