DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: multiple detail rows into one row

  1. #1
    Join Date
    Apr 2002
    Posts
    2

    Question

    I am trying to select multiples detail rows into one header row for a group of records I selected in a cursor. Specifically, I have a gift that is split between 1 or many accounts. I want to display two of these accounts in one record for each record brought back in the cursor. And, I want to set a variable if there are more than two. Any ideas???

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    select count(*)

    We need more detail about what your table structures are, what your PK on each table is, and some sample data.
    Jeff Hunter

  3. #3
    Join Date
    Apr 2002
    Posts
    2
    I have created a temporary table to store multiple selects in while executing a package. I do not have any PKs on this temp table. I am selecting data from primary_pledge, pledge, allocation, entity, and address tables.

    Let me give an example, I have a primary_pledge(gift) that is split into multiple pledges(gifts). Each of these gifts is associated with a different allocation. I am trying to bring back up to two allocation for each primary pledge. The allocation number can be found in the pledge table. I want the record to look something like this:

    id, name, address, pledge #, allocation1, allocation2, more than two allocations flag...

    id-- connects entity, address, and pledge
    pledge#-- connects primary_pledge and pledge
    allocation code-- connects pledge and allocation

    Please advise how I might do this for a group of pledges

  4. #4
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Sounds like a job for PL/SQL...
    Jeff Hunter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width