Solved

Oracle query- rows like columns

Posted on 2014-02-14
7
337 Views
Last Modified: 2014-02-28
select count(unit_id),procedure_code,site_name
  from donations@pdon_new don,
       drives@pdon_new dr,
         sites s
 where coll_date  between '01-jan-2014' and '12-feb-2014'
   and don.drive_id = dr.drive_id
   and s.lt_location_id = dr.location_id
   and dr.location_id = 'LOCN100008'
   and don.unit_id is not null
   and don.donation_type = 'AL'
   and don.donor_id in (select donor_id
                          from hbc_donor_schedule sched
                         where sched.donation_type = 'AL'
                           and sched.status = 'CNFRM'
                           and sch_date > don.coll_date)
                                       group by procedure_code,site_name;

COUNT(UNIT_ID),    PROCEDURE_CODE,    SITE_NAME
        33,                      CO,                         Aurora Donor Center
          4,                      DR,                         Aurora Donor Center
          3,                      PL,                          Aurora Donor Center
       168,                     PP,                          Aurora Donor Center
          2,                      RP,                          Aurora Donor Center
          5,                      RS,                          Aurora Donor Center
        64,                      WB,                        Aurora Donor Center

I wanted the display to be as shown below

Aurora Donor Center  CO   DR  PL    PP     RP   RS    WB

                                   33    4     3   168    2    5     64
0
Comment
Question by:anumoses
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 39859371
You have to have a fixed number of columns.  They cannot be dynamic.

Will you have fixed rows to convert?
0
 
LVL 6

Author Comment

by:anumoses
ID: 39859387
No
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39859438
Then I do not believe you can do what you want.

You can generate a CSV or other delimited string then parse it out from the application but even with the application, you will likely need to know how many fields you will have.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 6

Author Comment

by:anumoses
ID: 39877226
I've requested that this question be deleted for the following reason:

I have a feeling that this question can be deleted as there is no possibility of getting what is required.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39877227
I believe you did get the answer to the question you asked.

Please review:  The experts told me “you can’t do that”. What do I do now?
http://support.experts-exchange.com/customer/portal/articles/755964
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 39895561
NA
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question