Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 20 Aug 2015 @ 13:03:11 GMT


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


Subj:   Re: Query to return records which are in sequence
 
From:   Ganga, Sandeep Kumar

Vipin,

May be I took the question in wrong way but I am assuming my previous solution was very close to the answer, all we need to do is remove +1.

Please check the below if this works for you, correct me If I am Wrong.

     SQL
     --------------------------
     select sum(val)/ (
     SELECT MIN(hh)
     FROM    hourvalue vh
     WHERE   NOT EXISTS
     (
     SELECT NULL
     FROM    hourvalue hv
     WHERE   hv.hh = vh.hh + 1))
     from hourvalue
     where hh < (
     SELECT MIN(hh) + 1
     FROM    hourvalue vh
     WHERE   NOT EXISTS
     (
     SELECT NULL
     FROM    hourvalue hv
     WHERE   hv.hh = vh.hh + 1))

     --------------------------

Thanks,

Sandeep.

GANGA SANDEEP KUMAR



     
  <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