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

Explain what are magic tables in sql server?

1047


In what sequence sql statement is processed?

1057


what are user defined datatypes and when you should go for them? : Sql server database administration

1065


How to convert character strings into numeric values?

1152


How many triggers are possible per table?

1141


What are the properties of sub-query?

1134


You have a stored procedure, which execute a lengthy batch job. This stored procedure is called from a trigger you do not want to slow the data entry process you do not want trigger to wait for this batch job to finish before it completes itself what you can do to speed up the process?

1193


Explain about SQLOS?

1060


What is a scheduled job or what is a scheduled task?

1012


Can a stored procedure call itself or recursive stored procedure? How much level sp nesting is possible?

1078


Is it ok to shrink transaction log?

1057


If you want to send some data from access database to sql server database. What are different component of ssis will you use?

1027


How can you list all the table constraints in a database?

985


what is the difference between delete table and truncate table commands? : Sql server database administration

1081


Suppose i have a table that contains 5 columns like col1,col2...colm5.I want to import only two column through BCP utility.How to do same through BCP in sybase.

2462