Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by ~~Hari.Bagra
»
Find Nth Maximum from a Table...
Find Nth Maximum from a Table...
Rate Topic
Display Mode
Topic Options
Author
Message
Hari.Sharma
Hari.Sharma
Posted Saturday, September 29, 2007 11:57 PM
Ten Centuries
Group: General Forum Members
Last Login: Wednesday, December 26, 2012 12:43 PM
Points: 1,330,
Visits: 455
Comments posted to this topic are about the item
Find Nth Maximum from a Table...
Cheers,
Hari
Tips & Tricks for SQL BI Developers
Post #404608
Dhananjay Kulkarni-482726
Dhananjay Kulkarni-482726
Posted Sunday, October 21, 2007 11:25 PM
Forum Newbie
Group: General Forum Members
Last Login: Monday, November 19, 2007 7:24 AM
Points: 1,
Visits: 6
Hi,
This query is absolutely woking fine ...but if two employees r aving the same salary then it does not show correct result.. actuly it should show both employees for that rank.
this can be found using this query...:-->
select * from @table
where salary in (select top 1 salary from @table
where salary in (select top
3
salary from @Table order
by salary
desc
)
order by salary
)
Looks complicated but not so ...
Post #413259
Madhivanan-208264
Madhivanan-208264
Posted Friday, September 19, 2008 6:59 AM
Old Hand
Group: General Forum Members
Last Login: Wednesday, September 12, 2012 5:17 AM
Points: 329,
Visits: 461
May be the old thread but I want to show you other approaches
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/find-nth-maximum-value.aspx
Madhivanan
Failing to plan is Planning to fail
Post #572478
Amulya Dutta
Amulya Dutta
Posted Monday, August 17, 2009 11:49 PM
SSC Rookie
Group: General Forum Members
Last Login: Tuesday, November 15, 2011 9:01 AM
Points: 30,
Visits: 63
top 5th Salary of every department
SELECT * FROM (
SELECT EMP_ID, DEPT_ID, SALARY, NAME
,RANK() OVER (PARTITION BY DEPT_ID ORDER BY SALARY DESC) AS RANKID
FROM EMP) A WHERE RANKID = 5
Post #772429
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.