Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to find nth highest salary

Answer Posted / nandkumar karlekar

Take this script and try u will get nth salary as you wish

create Table EmpTest
(
ID bigint,
Sal bigint
)
go
insert into emptest
values
(1,100)

insert into emptest
values
(2,200)

insert into emptest
values
(3,300)

insert into emptest
values
(4,400)

insert into emptest
values
(5,500)

insert into emptest
values
(6,600)
go
DECLARE @n bigint
--specify your nth salary
SET @n=3

select top 1 * from Emptest
where @n <= (select Count(*) from Emptest EE where EE.sal
>Emptest.sal)
order by sal desc

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between mysql and sql server?

943


What are scheduled tasks in sql server?

1011


What do we have to check in database testing?

969


role of sql sever 2005 in database rather than any other database

1889


How to declare a cursor with "declare ... Cursor" in ms sql server?

982


How to check parameter value in stored procedure sql server?

916


What is buffer cash in sql server?

1099


What are different replication agents and what's their purpose? : sql server replication

960


How many columns can we include on clustered index ?

928


Can we insert data into a view?

1065


Explain the relational database management system (rdbms)?

1021


Explain what you mean by 3 tier architecture.

1020


What is history table in sql server?

896


Can You Use Data Mining Models In Ssrs?

139


Do comments need to go in a special place in sql server 2005?

814