Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

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.



  


 Title: solve this query
 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

  




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 Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi335
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software