how to delete top 5 salary from employee table

General
Enthusiast

how to delete top 5 salary from employee table

Hi Experts,

could you please share me how to delete top 5 salary from employee table.

Thanks in advance..

Regards,

Purushotham.

2 REPLIES
Enthusiast

Re: how to delete top 5 salary from employee table

DELETE FROM SAL WHERE SALARY_AMT IN  
(SELECT  SALARY_AMT FROM  (SELECT  SALARY_AMT FROM SAL  QUALIFY ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY SALARY_AMT DESC)<6)A)

OR

DELETE FROM SALARY_TABLE WHERE SALARY_AMT IN 
(SELECT  SALARY_AMT FROM  (SELECT TOP 5 SALARY_AMT FROM SAL ORDER BY SALARY_AMT DESC )A)
Enthusiast

Re: how to delete top 5 salary from employee table

Thank u so much sravan...

I tried the above code which u shared is working fine..

Regards,

Purushotham.