0 - 13 of 13 tags for rank

As per below data, I need to generate a rank or row number type column based upon the following scenarios:


1) For a Location-Order-ID combination, it should be a same number irrespective of other columns (like Class/Date in this example).

SELECT TOP 100 sku,
FROM trnsact;

Not really I want

The following is what I want and I only want the top 5 line, how can I do it

Select Region,Store,Sales,
   Rank()over(partition by Region Order by sales desc) as SalesRank 
from SalesTable 
Qualify SalesRank>=4

Region	Store	Sales	SalesRank
2	821	82224	1
2	615	5323	2
2	143	5323	2
2	242	4123	4

Desired Output	
Region	Store	Sales	SalesRank
2	821	82224	1
2	615	5323	2
2	143	5323	2
2	242	4123	3
/*I have two views in a company’s HR database I am pulling from. 

One gives a list of hiring actions. The first time an employee is hired, they’re given a sequence of 1. Each time after they’re given a sequence of 2, 3, 4 and so on.

The second view I’m querying has similar information for employees who were terminated. 

Hi All,
I am have a table with undergoes CDC type 2. With the column Effective start date used for previous/inactive record.
Now i need a record with columns ACTIVE_PREV and ACTIVE_CURR (examples) along with their previous values as shown below.

So i've been searching all around on how i could increment a column in Teradata. I'm new to this so im not really familiar with all the syntax or tactics that i could use. 
I've read about autogenerated identity column, OLAP and recursive in teradata but i think it does not matches my need. 
So here's my problem.

I am attempting to rank entires in a table, but want the rank to start over with each new value in the ID field.  The idea is to create a unique identifier out of the NAME and the ranking which is based on the number of lines of each ID value.  See example below...
Here is the source data:

I've run into an issue with a rollup I am trying to do and was wondering if anyone has any ideas on how to do it in as few steps as possible.
I have used several olap functions to build a table that has the following data:


I am a beginner concerning the Teradata. I was trying to find simple descriptions on the internet about functions QUALIFY; RANK; OVER; PARTITION BY - unfortunately unsuccessfully. I coudn't find a simple explanation what does each of the funcions do.

Can anyone send me a link or give a explanation about this functions.

For every Sale_Month, I would like to get the top 3 Item_Types for each Employee_Name dense ranked based on the on the Num_Sales. Currently I am getting "Modified competition ranking" instead of Dense Ranking"

Dense ranking ("1223" ranking)

Modified competition ranking ("1334" ranking)


How can I change my SQL to get "Dense Ranking" instead of "Modified competition ranking"?

From (

I have a table with Columns A, B below but I want to create Column C

Column C is explained as follows: Ordering by Column A ASC I want to replicate the value od Column B for all succeeding rows until a Non-Null value is met, then start again.

Hi gurus,

I need to know the difference between rownum and rank function

I am working on Teradata to Oracle migration project.

Select frm_crncycd,to_crncycd,exch_rate from exchange_rate
group by 1,2
qualify(rank(frm_dt)) =1

Can someone explain what is the behavior of above query.
So that i can rewrite the query in Oracle.