Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 24 Dec 2004 @ 11:26:15 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Selecting days & hours difference
 
From:   venkataramanamurthy.t

I am facing a problem with the following given query.

     SELECT
           atrr.audit_date,
           atra.audit_date,
            (cast(cast(ATRR.audit_date as FORMAT 'yyyy-mm-dd hh:mi:ss') as
     date) - cast(cast(ATRA.audit_date as FORMAT 'yyyy-mm-dd hh:mi:ss') as
     date)),
            CASE
               WHEN (2 - (cast(cast(ATRR.audit_date as FORMAT 'yyyy-mm-dd
     hh:mi:ss') as date) - cast(cast(ATRA.audit_date as FORMAT 'yyyy-mm-dd
     hh:mi:ss') as date))) < 0 THEN 'N/A'
               ELSE (2  - (cast(cast(ATRR.audit_date as FORMAT 'yyyy-mm-dd
     hh:mi:ss') as date) - cast(cast(ATRA.audit_date as FORMAT 'yyyy-mm-dd
     hh:mi:ss') as date)))
           END
      FROM T_DWSRAD1DB. TE22AC1_Audit_trail     ATRR,T_DWSRAD1DB.
     TE22AC1_Audit_trail ATRA
     where ATRR.proc_id = ATRA.proc_id and ATRR.proc_id = 10

Audit_date datatype is timestamp which holds the value "2004-11-19 10:01:00.000000" and another values is "2004-11-22 15:35:00.000000".

we are using the same field for finding the days diff and hours diff and etc.

we are getting the days difference by executing the above query but we also need to get the hours diff and etc.

What is the procedure to get the days difference and hours difference and etc using the above given query?


Thanks in advance.

Venkataramanamurthy T
Tata Consultancy Services Limited



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023