我有超过500万条记录需要分成两部分 我用过这个
/*(cast(cast(cast(A.ORD_DTS as char(19)) as timestamp(0)) as date) >=
(add_months(current_date,-13))- extract(day from add_months(current_date,-13))+1)
*/
如何选择2015-03-31'到2014-09-01' ?
--current_date,-13
--CURRENT_DAY=10/14/2015
--09/01/2014 12:00:00.000000 --MIN --13 CURRENT
--10/13/2015 4:00:06.000000 --MAX --13 CURRENT
我试过
cast(cast(cast(A.ORD_DTS as char(19)) as timestamp(0)) as date)
BETWEEN CAST('2015-03-31' AS DATE ) AND CAST('2014-09-01' AS DATE )
答案 0 :(得分:1)
检查出来..执行了它,但它应该有效。Select * from table A where A.ORD_DTS >= DATE '2014-09-01' and A.ORD_DTS <= DATE '2015-03-31'