472,127 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

How to PIVOT in Oracle 8i

55
I need to generate the count of new subscribers per day for a cable company,I can generate the rows vertically but I need to turn them into columns in oracle 8i.How do I generate the following output?
1-Jan-09 2-Jan-09 3-Jan-09 4-Jan-09 5-Jan-09 6-Jan-09
count
Thnaks
Mar 12 '09 #1
1 4993
amitpatel66
2,367 Expert 2GB
This sample code might help:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT SUM(CASE WHEN deptno = 10 then 1 ELSE 0 END) dept_10,
  3. SUM(CASE WHEN deptno = 10 then 1 ELSE 0 END) dept_20,
  4. SUM(CASE WHEN deptno = 10 then 1 ELSE 0 END) dept_30,
  5. SUM(CASE WHEN deptno = 10 then 1 ELSE 0 END) dept_40
  6. FROM 
  7. dept;
  8.  
Mar 12 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Prasad Patil | last post: by
1 post views Thread by Michael John | last post: by
2 posts views Thread by Rob | last post: by
2 posts views Thread by Carl Gilbert | last post: by
3 posts views Thread by Jerry K via DotNetMonster.com | last post: by
3 posts views Thread by GoalieGW | last post: by
9 posts views Thread by PeteCresswell | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.