資料庫名稱: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只取日期判斷,無法包含時間
不知道要怎麼做,才可以達到 用日期+時間來做資料篩選,請大大們教導一下...