Tuesday, 7 August 2012

Second highest salary

1. METHOD

select max(salary) from emp where salary not in (select max(salary) from emp )

 2. METHOD ANY SALARY-- PUT NUMBER OF COUNT IN SUB-QUERY


SELECT TOP 1 Salary FROM ( SELECT TOP 5 Salary FROM emp ORDER BY Salary DESC)TEMP ORDER BY Salary

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...