Solved

Oracle query- rows like columns

Posted on 2014-02-14
7
316 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
  • 3
  • 3
7 Comments
 
LVL 76

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 76

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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 76

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
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 …
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…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now