Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 16 Jun 2003 @ 15:13:34 GMT


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


Subj:   Re: Consecutive sequence sql logic
 
From:   Bankston Jr, Robert E

This should work. It may have a syntax error or two. Let me know if you have any questions.

SELECT
* FROM MYTABLE
WHERE (ACCT) IN
(
SELECT
ACCT
FROM
(
SELECT
ACCT,
COUNT(*)
FROM
(
SELECT
ACCT,
PHONE,
COALESCE(MDIFF(PHONE,1,PHONE ASC),1) AS MDFF_PHN
FROM MYTABLE
GROUP BY 1) AS SBQRY
GROUP BY 1
WHERE MDFF_PHN = 1
HAVING COUNT(*) >= 5) AS SBQRY2

Rob Bankston
Teradata Certified Professional
UnumProvident - Data Warehouse



     
  <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