Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 14 Sep 2011 @ 09:51:22 GMT


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


Subj:   Re: Mdiff on Date field
 
From:   Dieter NC6th

Anomy.Anom wrote:

  I am trying to use mdiff on date field. It is working however when the month/year changes, the mdiff values are wrongly interpreted. I guess this is due to the fact that TD stores date as integerdate.  


And MDIFF seems to work on numeric data only, so there's an automatic typecast to INT. But you shouldn't use MDIFF anymore, as it's non- Standard SQL.

Better rewrite it to:

     dt - min(dt)
          over (partition by id
                order by dt
                rows between 1 preceding and 1 preceding)

Dieter



     
  <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