Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Fri, 28 Aug 2009 @ 10:20:34 GMT

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

Subj:   Re: Easy way to get the latest updated row in a query
From:   Dieter Noeth

Victor Sokovin wrote:

  Dieter, this is also the extra condition that you seem to be using without stating it. In general, we don't know how column-level maxima are distributed across the rows in partitions. It can happen that MAX(timeStampKey1) and MAX(sequenceNbrKey1) can sit on different ones and the JOIN in the OP's query will return no rows. A more careful rewrite of that query in OLAP terms should probably include two QUALIFY clauses. Agreed?  


It looks like there are several rows with the same timeStampKey1 but different sequenceNbrKey1 (or the other way).

Otherwise there might be no row with both max values and a single QUALIFY will return a false row.

But we need to see the actual query to judge that.

It seemed to be a general question, so this was the general answer :-)


  <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