GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Oracle  >  General

 Print  |  
Question:   dear friend

i want to know that in a table how to change the column to row.





October 10, 2006 01:47:22 #2
 prabu   Member Since: Visitor    Total Comments: N/A 

RE: dear friendi want to know that in a t...
 
Hi friends, We have to change the column into row like this.It is a pivoting table . For exampleDEPTNO COUNT(*)------- ---------- 10 3 20 5 30 4 40 DEPT_10 DEPT_20 DEPT_30 DEPT_40------- ---------- ---------- ---------- 3 5 4 select MAX( decode( deptno, 10, cnt, null ) ) dept_10, MAX( decode( deptno, 20, cnt, null ) ) dept_20, MAX( decode( deptno, 30, cnt, null ) ) dept_30, MAX( decode( deptno, 40, cnt, null ) ) dept_40 from ( select deptno, count(*) cnt from emp group by deptno ) group by deptno
     

 

Back To Question