I have Company table which has companyname,Program and ReceivedAmount
Program Account Table is like Lookup Table.It says for which program and for acccount number how much money is allocated. From this table money is distributed based on Program and Accountnumber.
Company ( Main table)
CompanyName Program ActualReceivedAmount
A P1 140000
B P2 136000
C P2 76000
D P2 220000
E P2 52000
ProgramAccount ( This is lookup table)
Program AccountNumber AccountAmount
P1 100011 24000
P1 100012 116000
P2 100045 180000
P2 100046 304000
I want to get output like this from above.
CompanyName Program AccountNumber ActualReceivedAmount
A P1 100011 24000
A P1 100012 116000
B P2 100046 136000
C P2 100046 76000
D P2 100045 180000
D P2 100046 40000
E P2 100046 52000
Or
CompanyName Program AccountNumber ActualReceivedAmount
A P1 100011 24000
A P1 100012 116000
B P2 100045 136000
C P2 100045 44000
C P2 100046 32000
D P2 100046 220000
E P2 100046 52000
Or this combination
CompanyName Program AccountNumber ActualReceivedAmount
A P1 100011 24000
A P1 100012 116000
B P2 100045 136000
C P2 100046 76000
D P2 100046 220000
E P2 100046 8000
E P2 100045 44000
Any Combination is fine. We will not try to split unless it is required. we will try to use as money as possible in that account.We will not try to split unless it is required.
we will try to use as money as possible in that account.
Please help.