teradata select 特定范围的月份
teradata select a specific range of months
我有超过 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)
*/
如何select从'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 )
检查一下。没有执行它,但它应该可以工作。Select * from table A where A.ORD_DTS >= DATE '2014-09-01' and A.ORD_DTS <= DATE '2015-03-31'
我有超过 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)
*/
如何select从'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 )
检查一下。没有执行它,但它应该可以工作。Select * from table A where A.ORD_DTS >= DATE '2014-09-01' and A.ORD_DTS <= DATE '2015-03-31'