Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 20 Aug 2015 @ 10:09:46 GMT


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


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

Hi Gupta Vipin,

Please try below, and see If this helps,

     create table hourvalue (hh integer, val Integer);
     insert values,

     SQL
     --------------------------
     select sum(val)/ (
     SELECT MIN(hh) + 1
     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