Please help me [message #277011] |
Sat, 27 October 2007 23:40 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
jigart4586
Messages: 3 Registered: October 2007 Location: india
|
Junior Member |
![jigart4586](/forum/theme/orafaq/images/yahoo.png)
|
|
Please help me on solve this query :
display all information from emp whose salary is third maximum.
Thanx in advance.
|
|
|
|
Re: Please help me [message #277023 is a reply to message #277011] |
Sun, 28 October 2007 01:23 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68733 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
I help you:
1/ try to do your homework and tell us where you're stuck
2/ search on board, this homework has been answered many times
3/ don't trust any answer, verify them
Regards
Michel
[Updated on: Sun, 28 October 2007 01:23] Report message to a moderator
|
|
|
Re: Please help me [message #277035 is a reply to message #277011] |
Sun, 28 October 2007 02:51 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
el33t
Messages: 29 Registered: October 2007
|
Junior Member |
|
|
see "rownum" is not available in other db like MySQL only specific to oracle.
here is another way but too many subqueries is not good
select max(salary) from emp where salary <(select max(salary) from emp where salary <(select max(salary) from emp))
and yet another way:
select top 3 salary from emp where salary not in ( select top 2 salary from emp order by salary desc ) order by salary desc
|
|
|
Re: Please help me [message #277038 is a reply to message #277011] |
Sun, 28 October 2007 03:14 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Arju
Messages: 1554 Registered: June 2007 Location: Dhaka,Bangladesh. Mobile:...
|
Senior Member |
![a_arju](/forum/theme/orafaq/images/yahoo.png) ![arjuiut](/forum/theme/orafaq/images/google.png)
|
|
SQL> select top 3 salary from emp where salary not in (
select top 2 salary from emp order by salary desc ) order by
salary desc
;
select top 3 salary from emp where salary not in ( select top 2
salary from emp order by salary desc ) order by salary desc
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
[Updated on: Sun, 28 October 2007 03:14] Report message to a moderator
|
|
|
|
Re: Please help me [message #277065 is a reply to message #277045] |
Sun, 28 October 2007 06:05 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
el33t
Messages: 29 Registered: October 2007
|
Junior Member |
|
|
I know that and i also said rownum is oracle specific...so i purposely gave top query..and arju and yourself , the oracle masters on this board,verified that.
As Monsieur Michel say:
Quote: | 3/ don't trust any answer, verify them
|
Thank You.
[Updated on: Sun, 28 October 2007 06:21] Report message to a moderator
|
|
|
|
|
|
Re: Please help me [message #277118 is a reply to message #277090] |
Mon, 29 October 2007 00:20 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
el33t
Messages: 29 Registered: October 2007
|
Junior Member |
|
|
well if he can put up his real picture then it can be really confirmed..whats his date of birth in his profile is indeed how old man he is (unless of course he has not done some plastic surgery or taking any "BOTOX" shots)
[Updated on: Mon, 29 October 2007 00:21] Report message to a moderator
|
|
|
|