Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Oracle query- rows like columns

Posted on 2014-02-14
7
Medium Priority
?
345 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 1500 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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 post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

722 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