Archives of the TeradataForum
Message Posted: Mon, 23 Aug 2004 @ 10:23:35 GMT
Subj: | | Re: Alternative for Rank function |
|
From: | | Dieter Noeth |
R.Lakshman wrote:
| Actuallu i want to write a SQL query which fits for other databases too.Since RANK is Teradata Extensions it cannot be used in other
databases.Please give me an idea how to do the same without using the functions. | |
Rank *is* SQL:1999 and SQL:2003 and supported by Oracle and DB2, the next version of MS SQL Server will support it, too.
You just have to use the ANSI sytle Rank instead of proprietary Teradata Rank.
Teradata SQL -> rank(salary_amount)
SQL:1999 -> rank() over (order by salary_amount desc)
Without Rank the same result can be achieved by joins using "<=" which results in horrible performance.
Dieter
|