| SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it. |
|
||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
|
|||
SELECT TOP 1 quantity FROM TradeIs this query will work? If it works what should be the output? regards, venkat |
|
|||
|
Hi..is it possible to write the same query without using top & max...
can anyone tell me?? Yes it is possible to answer by using correlated queries. select sal from emp e where 1=(select count(*) from emp where e.sal<sal); This is a cheap query written..............asdfadfaaf |
|
|||
|
This will get you only the second max salary row
SELECT * FROM EMPfrom how to find second largest number through a query in sql - Community Forums - Developer Fusion, the UK developer community - VB, ASP, C#, .NET, PHP and XML tutorials & source code
SELECT * FROM tmp_table m1 |
|
|||
|
Hello
can any buddy suggest me how to get the 3rd highest value from table and can ve right any query to get 4th, 5th as well?For finding 2'nd largest row , we can use various forms ..like (1) select max(value1) from ( select value1 from val minus select max(value1) from val ); (2) Select max(value1) from val where value1 < ( Select max(value1) from val ); (3) select max( value1) from val where value1 not in( select max(value1) from val ); But there is 1 General way also..we can simply use this formula-- select rownum,ename,eno from emo gropu by rownum,ename,eno having rownum > n minus select rownum, ename , eno from emp group by rownum,ename,eno having rownum > n ; cheers... |
|
|||
|
Second highest value could be find out by entering this command:-
Let say u want to find out salary(second highest) from employ table then.. SELECT MAX(SALARY) FROM EMPLOYEE WHERE SALARY NOT IN (SELECT MAX(SALARY) FROM EMPLOYEE) Regards, Mohammed Obaid Khan Pune, Maharashtra India |
![]() |
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to find out the 4th highest value from the column? | Anoj biradar | SQL - Questions and Answers | 4 | 02-21-2008 07:24 AM |
| How to find second highest value of a column in a table? | SQL? | jaheer | SQL - Questions and Answers | 10 | 07-24-2007 11:07 AM |
| how to find third highest record from table? | davinder singh | SQL - Questions and Answers | 3 | 12-19-2006 11:57 AM |