Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 08 Jan 2002 @ 16:41:31 GMT


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


Subj:   Re: Ranking within dimensions
 
From:   Jim Downey

Lee

I assume you run something like:

SEL  RANK(SALES) as The_Rank
,    PRODUCT
FROM TABLE
QUALIFY   THE_RANK<=10
;

I think you want to change it to look like:

SEL  AREA
,    RANK(SALES)
,    PRODUCT
FROM TABLE
GROUP BY 1
QUALIFY   THE_RANK<=10
;

Note that the group by clause is on Area so it will break by area. I find it easier to figure out what is going on when writing SQL using ;the OLAP functions to put everything you want to group by above the olap function and what you are olap'ing to be below the function. In this case you are ranking product grouping by area.

I hope that helps.

Jim



     
  <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: 27 Dec 2016