469,133 Members | 1,167 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,133 developers. It's quick & easy.

How to PIVOT in Oracle 8i

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
Mar 12 '09 #1
1 4826
2,367 Expert 2GB
This sample code might help:

Expand|Select|Wrap|Line Numbers
  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;
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 zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.