Archives of the TeradataForum
Message Posted: Mon, 23 Aug 2004 @ 13:24:20 GMT
Subj: | | Re: Alternative for Rank function |
|
From: | | Victor Sokovin |
| I have found the alternative for the rank function.Just i would like to share the information. | |
SELECT A.salary_amount FROM employee A WHERE 10 = (SELECT DISTINCT
COUNT(B.salary_amount) FROM employee B WHERE A.salary_amount <= B.salary_amount);
| this query gives me the desired result for finding the nth max value or min value in the table.the above query will give me the 10th max
value in the table. | |
I think that's what Dieter meant by joins with inequality conditions. Perhaps the query above works for the particular data you have in
the table but it can give strange results when the context changes. Only for that reason I would stay clear of such joins. Dieter already
mentioned performance problems they imply.
Regards,
Victor
|