I would like to know how i can retrieve second max of a field in a table. For ex i have a salary table which gives the details of salary drawn by all employees in an organisation. I want to write a query which gets the second largest salary from the table. Can u pls help me out to get this. Thanks in advance.<BR>Pls respond to firstname.lastname@example.org as early as possible.Looking forward for u'r reply.
Hello Meena!<BR><BR>Please check this out and tell me if it works out:<BR> <BR>create table #Temp(Num int)<BR>insert into #Temp select top 2 salary from Salary order by salary desc<BR>select min(Num)from #Temp<BR>drop table #Temp