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