Potaiza
Potaiza

Reputation: 25

teradata select a specific range of months

I have more than 5million of records that I need to split in two part where I used this

/*(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) 
*/

How can select from '2015-03-31' to '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

I tried

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 )

Upvotes: 1

Views: 913

Answers (1)

anwaar_hell
anwaar_hell

Reputation: 776

Check this out..didnt executed it but it should work.Select * from table A where A.ORD_DTS >= DATE '2014-09-01' and A.ORD_DTS <= DATE '2015-03-31'

Upvotes: 1

Related Questions