Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 16 Jun 2003 @ 14:59:38 GMT


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


Subj:   Re: Consecutive sequence sql logic
 
From:   Burton, Bruce

here is what I came up with:

sel distinct acct
from
(sel
file1.acct, file1.mobile, file2.mobile, file3.mobile, file4.mobile,
file5.mobile

from

(select acct, cast (mobile as decimal(12,0)) as mobile
from mktdb.p816_master
where bus_ind=1 and bus_seg ='A') file1

inner join

(select acct, cast (mobile as decimal(12,0)) as mobile
from mktdb.p816_master
where bus_ind=1 and bus_seg ='A') file2

on file1.acct=file2.acct and file1.mobile-file2.mobile =1

inner join

(select acct, cast (mobile as decimal(12,0)) as mobile
from mktdb.p816_master
where bus_ind=1 and bus_seg ='A') file3

on file2.acct=file3.acct and file2.mobile-file3.mobile =1

inner join

(select acct, cast (mobile as decimal(12,0)) as mobile
from mktdb.p816_master
where bus_ind=1 and bus_seg ='A') file4

on file3.acct=file4.acct and file3.mobile-file4.mobile =1

inner join

(select acct, cast (mobile as decimal(12,0)) as mobile
from mktdb.p816_master
where bus_ind=1 and bus_seg ='A') file5

on file4.acct=file5.acct and file4.mobile-file5.mobile =1)

unique_acct


     
  <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