sql satement for 2nd maximum value
Answers were Sorted based on User's Feedback
Answer / archana chavan
select top 1 * from author where phone < (select max(phone)
from author) order by phone desc
Is This Answer Correct ? | 18 Yes | 4 No |
Answer / murli d
author is Table name
ID is column name
select top 1 * from author where ID < (select max(ID)
from author) order by ID desc
Is This Answer Correct ? | 16 Yes | 3 No |
Answer / cherran
select top 1 sal from
( select top 2 sal from test order by sal desc ) as kk order
by sal
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / avnish
create table emp with row empsal having the datatype float
and insert some salary
now to get the second max salary
write the sql statement
select max(empsal) from emp where empsal<(select max(empsal)
from emp)
its asubquery
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / sanjeev singla
Hey guys use this query ,i used it so many time ,it will be
useful to you..try this one...
SELECT MAX(Salary) AS Expr1
FROM Employees
WHERE (Salary <
(SELECT MAX(Salary)
FROM Employees))
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / ramavtar rajput
select Amount from T2 where Amount = ( select max(Amount)
from T2 where Amount < ( select max(Amount) from T2 ))
Is This Answer Correct ? | 3 Yes | 3 No |
Answer / kaushal gajjar
select top 1 UnitsInStock
from products
where UnitsInStock in (select top 2 UnitsInStock from
products order by UnitsInStock desc)
Is This Answer Correct ? | 4 Yes | 4 No |
Answer / suresh
department as table name,sfee as column name
SELECT TOP (1) sfee
FROM DEPARTMENT
WHERE (SFEE IN
(SELECT TOP (2) SFEE
FROM DEPARTMENT AS
DEPARTMENT_1
ORDER BY SFEE DESC))
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / jacob
1)Select Max(Total) from mark
2)select top 1 total from
( select top 2 total from mark order by total desc ) as
result order
by Total
Is This Answer Correct ? | 0 Yes | 0 No |
How can we store decimal data in .net?
What is the advantage of using system.text.stringbuilder over system.string?
what is the need for dynamic controls in vb.net? i would like to know for what purpose should we create the controls dynamically? please give the answer in simple words.
what r the properties should be given to set method?
I'm unable to open a .hlp file using vb.net application.
Compare c# and visual basic.net?
So you know which dll is used for microsoft .net run time?
What is option strict?
How to run a dos command in vb.net?
Can you please explain the difference between dispose and finalize()?
Explain how to store decimal data in .net?
Explain namespace?