sandeep kumar
Who to find 2nd lowest salary in employee table
By sandeep kumar in SQL Server on Feb 08 2015
  • saravanagopi s
    Feb, 2015 19

    select top 1 salary from(select distinct top 2 salary from emps order by Salary)a order by a.salary desc

    • 2
  • Satyam Verma
    Apr, 2015 12

    select salary from table order by salary offset 2 rows fetch next 1 rows only

    • 1
  • Abrar Ahmad Ansari
    Mar, 2015 10

    SELECT SALARY FROM(SELECT SALARY, ROW_NUMBER() OVER(ORDER BY SALARY ASC) AS ROWNUM FROM SALARYTABLE ) SAl WHERE ROWNUM=2

    • 1
  • raj kadam
    Feb, 2015 28

    select MAX(sal) from emp where sal not in(select MAX(sal) from Emp)

    • 1
  • sandeep kumar
    Feb, 2015 8

    SELECT MAX(SALARY) FROM (SELECT TOP 2 SALARY FROM EMPLOYEE ORDER BY SALARY ASC) Res

    • 1
  • Sohan Yadav
    Nov, 2017 3

    Select Top 1 Salary as '2nd Minimum Salary' from (Select distinct top 2 salary from TableName order by Salary desc) a order by Salary asc

    • 0
  • Sohan Yadav
    Nov, 2017 3

    Select Top 1 Salary as '2nd Minimum Salary' from (Select distinct top 2 salary from TableName order by Salary desc) a order by Salary asc

    • 0
  • Sohan Yadav
    Nov, 2017 3

    Select Top 1 Salary as '2nd Minimum Salary' from (Select distinct top 2 salary from TableName order by Salary desc) a order by Salary asc

    • 0
  • sushil kumar
    Jul, 2017 8

    Select max(sal) from salary where sal < (Select top 2 max(sal) from salary order by sal desc)

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashwani Chaudhary
    Oct, 2016 2

    select MIN(Salary) from Employee WHERE Salary <> (select MIN(Salary) from Employee )

    • 0
  • Ashish Srivastava
    Dec, 2015 20

    Select top 1 * from( select top 2 * from employees order by salary desc)t

    • 0
  • venkataramana reddy
    Dec, 2015 3

    Select TOP 1 Salary as '2rd Lowest Salary' from (SELECT DISTINCT TOP 2 Salary from Employee ORDER BY Salary ASC) a ORDER BY Salary DESC

    • 0
  • Pankaj  Kumar Choudhary
    Aug, 2015 26

    SELECT MAX(SALARY) FROM (SELECT TOP 2 SALARY FROM EMPLOYEE ORDER BY SALARY ASC) Res

    • 0
  • vinoth kumar
    Aug, 2015 18

    select TOP 1 salary from(select distinct TOP 2 salary from employee order by salary asc) a order by salary desc

    • 0
  • Suyambu Kesavan
    Jul, 2015 21

    select *from (SELECT DENSE_RANK() over (order by total_price desc) as SNO , total_price FROM Sales) as dr where SNO = 2

    • 0
  • Sujeet Suman
    Jul, 2015 19

    Select TOP 1 Salary as '2rd Highest Salary' from (SELECT DISTINCT TOP 2 Salary from Employee ORDER BY Salary ASC) a ORDER BY Salary DESC

    • 0
  • Ankit  Shukla
    Jul, 2015 8

    Select Top 1 EmployeeName,Salary from (Select Top 2 EmployeeName,Salary From TblEmployee order by Salary desc) TblTempEmployee order by Salary desc

    • 0
  • Junior Kadel
    May, 2015 14

    Select max(salary ) from table1 where salary not in (Select max(salary) from table1)

    • 0
  • Kml Surani
    Apr, 2015 14

    SELECT MIN(No) FROM dbo.tbltemp2 WHERE No NOT IN ( SELECT DISTINCT TOP 1NoFROM dbo.tbltemp2ORDER BY No )

    • 0
  • Jigar Tailor
    Apr, 2015 14

    SQL Server 2008 R2 or earlier SELECT SALARY FROM(SELECT SALARY, ROW_NUMBER() OVER(ORDER BY SALARY ASC) AS ROWNUM FROM SALARYTABLE) SAl WHERE ROWNUM=2SQL Server 2012 or Higher Select Salary From Table Order By Salary Offset 2 Rows Fetch Next 1 Rows Only

    • 0
  • Amar Gavali
    Apr, 2015 8

    select min(salary) from employee where salary<>(select min(salary) from employee);

    • 0
  • Amar Gavali
    Apr, 2015 8

    select min(salary) from employee where salary<>(select min(salary) from employee);

    • 0
  • Munesh Sharma
    Mar, 2015 30

    http://dotnet-munesh.blogspot.in/2013/12/important-sql-query.html

    • 0
  • Munesh Sharma
    Mar, 2015 30

    SQL Queries in SQL Server, select MAX(SALARY) from (select top 2 * from employee) a

    • 0
  • Akhil Garg
    Mar, 2015 29

    SELECT MIN(Salary) FROM Employee WHERE Salary NOT IN(SELECT MIN(Salary) FROM Employee)SELECT MAX(SALARY) FROM (SELECT TOP 2 SALARY FROM EMPLOYEE ORDER BY SALARY ASC)

    • 0
  • Shyam Narayan
    Mar, 2015 21

    select min(amount)from Payment where Amount not in (select distinct top 1 amount from Payment order by amount ASC ) for max select max(amount)from Payment where Amount not in (select distinct top 1 amount from Payment order by amount desc )

    • 0
  • Ganesh Saraf
    Mar, 2015 13

    select Sal from Emp e1 where 1=(select Count(e2.sal) from Emp e2where e2.sal>e1.sal)

    • 0
  • Guest User
    Mar, 2015 3

    As of SQL Server 2012 you can use: SELECT Salary FROM Employees GROUP BY Salary ORDER BY Salary OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY

    • 0
  • raj kadam
    Feb, 2015 28

    select MIN(sal) from emp where sal not in(select MIN(sal) from emp) for min sal

    • 0
  • raj kadam
    Feb, 2015 28

    select MAX(sal) from emp where sal not in(select MAX(sal) from Emp)

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS