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 >> sql query.try this!!!!!!!

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: sql query.try this!!!!!!!
 Rush  Posted: Feb 21, 2007 04:36:06 AM

 Total Post: 127
 Joined: Jan, 2007






 there is a table
proc_id quantity price state
------- -------- ----- -------
1 10 100 delhi
... ... ... UP
like this data are there. i want to take data item wise state wise total sales.plz show the right way.i have used group by in various forms but it doesn't work.
RUPESH
gullu02@gmail.com

 suzee
Posted: Feb 21, 2007 07:27:32 AM  

 Total Post: 21
 Joined: Feb, 2007






 
try ur qurey with groupby cube(column1,column2,column3)

select sum(column1),column2,column3 from tablename
where..........
groupby cube(column1,column2,column3);


 Rush
Posted: Feb 21, 2007 11:58:37 PM  

 Total Post: 127
 Joined: Jan, 2007






 
thanks Suzee!!thanks a lot :-) i have done that qury using groub by cube as you told me.it's working and i knew one new thing that how to take more than one colunm in group by using cube.
thanks again!!!!
RUPESH
gullu02@gmail.com

 Ghulam
Posted: Feb 22, 2007 03:05:51 AM  

 Total Post: 8
 Joined: Feb, 2007






 
Dear. Can you send me the code u tried for group by function

Thanks


 Rush
Posted: Feb 22, 2007 06:08:34 AM  

 Total Post: 127
 Joined: Jan, 2007






 
DEAR GHULAM THAT CODE WAS LIKE THIS....
select item_code,state,sum(qty*price) from
invoice
group by cube(item_code,state);
plz.. note that there are following columns in invoice table
item_code,qty,price,state.
Rupesh

 Ghulam
Posted: Feb 22, 2007 07:17:02 AM  

 Total Post: 8
 Joined: Feb, 2007






 
Thanks Rush.
Its great!!!!!
Its because I did my OCA 10g but never heard about CUBE statement in group functions....lol

 suzee
Posted: Feb 22, 2007 08:27:09 AM  

 Total Post: 21
 Joined: Feb, 2007






 
cube is in Oracle 9i

 ranju
Posted: Mar 07, 2007 12:46:44 AM  

 Total Post: 1
 Joined: Mar, 2007






 
Dear ghulam!
i want to know more about OCA-developer certification as iam planning for the same

 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 Gopi333
  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