Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 08 Jan 2002 @ 15:05:26 GMT


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


Subj:   Re: Ranking within dimensions
 
From:   Ulrich Arndt

Sorry, was a bit short.

Here some SQL to explain:

create table test
( product char(1),
area integer,
revenue integer
);

insert into test ('A',1,7);
insert into test ('A',2,6);
insert into test ('A',3,3);

insert into test ('B',1,5);
insert into test ('B',2,2);
insert into test ('B',3,8);

insert into test ('C',1,1);
insert into test ('C',2,9);
insert into test ('C',3,4);

select product, area, revenue, rank(revenue) as rev_rank
from test
group by area
order by area, rev_rank
;

drop table test
;

Ulrich



     
  <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