how to find the 2nd higgest salary in the column for example
take table name is employee?
And also find bottom 2nd lowest salary ?
Answer Posted / vishnu
Here we can find out 2nd highest salary in many ways,
according to the situation we can select anyone…
1st Type:
select min(esal) from emp where esal in (select top 2 esal
from emp order by esal desc)
2nd Type:
select max(esal) from emp where esal not in(select max(esal)
from emp)
3rd Type:
select max(esal) from emp where esal <(select max(esal) from
emp )
4th Type:
select Max(esal) from EMP a where 2=(select
COUNT(distinct(esal)) from EMP b where a.eSAL<=b.eSAL);
-----------------------------------------
For 2nd Lowest Salary:
-- 1st Type:
select min(esal) from emp where esal > (select min(esal)
from emp)
-- 2nd Type:
select * from emp where esal =
(
select max(esal) from emp where esal in (select top 2 esal
from emp order by esal)
)
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Explain different pipelining hazards? : Dot net architecture
How do I know when my thread pool work item has completed?
Explain pipelining? : Dot net architecture
what are the events for a form?
Differnce between managed code and unmanaged code ?
What is new in the .net 2.0 class library?
8. Oop-Why and were we use Interfacse and Abstract class.
I am working with asp.net 2005 and Crystal report 10. I have an image field on my dataset to show on Crystal report.And the image is shows dynamically from database in image field of CR. The image field is showing well on my Crystal report on its first page with all other data but when i click to open second page of CR,it does not show any data on that.I found that this is because of adding the image field on crystal report. Because when i remove the image field from the CR then it will run both the pages of CR. I am using the Page Load event to bind CR data with Database. And i have already check with the Init event to bind CR , but it still not shows the data on second page when i use image field on that. Please give solution for that.....
What are the major differences between services and web services?
Explain difference between state server and sqlserver? : .NET Architecture
Explain about .net garbage collector?
What are relation objects in dataset?
Does .NET runtime offer Deterministic Destruction or not?
Explain about httpruntime.cach.get(); method?
How do I stop a thread?