Topic: SQL*Plus and PL/SQL >> solve this query
|
Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property.
You may review the entire Oracle Certification Program Candidate Agreement online Here.
|
|
|
|
| Neeraj |
Posted: May 24, 2007 04:52:16 AM |
Total Post: 258
Joined: Jan, 2007
|
hi everyone,
plz help me to solve this oracle query
table
empid salary
1000 3000
1001 2500
1002 6000
1003 8000
1004 12000
output using sql query in oracle
range total emp
0-5000 2
5001-10000 2
10001-15000 1
plz reply soon
|
|
|
parth |
| Posted: May 24, 2007 11:00:08 AM | |
|
Total Post: 17
Joined: Apr, 2007
|
SELECT SAL,DECODE(SIGN(SIGN(SAL-1000)+SIGN(SAL-2000)),1,'2000-3000',0,'1000-2000',-1,'0-999')PARTH FROM EMP
ORDER BY SAL
try this one, it may help you.....:) not full answer...otherwise you wont try any more.....!
~Parth
|
|
|
|
|
Neeraj |
| Posted: May 25, 2007 05:48:44 AM | |
|
Total Post: 258
Joined: Jan, 2007
|
hi parth,
thxs for your help but its not working. can u giveme another query to show my desriable result.
|
|
|
|
|
sangeeta |
| Posted: May 27, 2007 03:41:37 AM | |
|
Total Post: 4
Joined: May, 2007
|
use COUNT() to make that query work...
SELECT count(*), DECODE(SIGN(SIGN(SAL-1000)+SIGN(SAL-2000))
,1,'2000-3000',0,'1000-2000',-1,'0-999')PARTH FROM EMP
group by sal
ORDER BY SAL;
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |
|
|
|
|
Forum Rules & Description
Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user
|
| |
Get FREE Magazines
|
Top 10 Forum User
|
| Murtuja Khokhar | 857 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Gopu Gopi | 335 |
| Gitesh Trivedi | 322 |
| Vinoth Kumar | 264 |
| neeraj sharma | 258 |
| Ramesh Jois | 246 |
|
|