I'm having some tables below:
Table A, with FundID, and Fund Type
FundID | Fund Type |
---|---|
A | Multi |
B | Prop |
Table B, with Fund, properties that are in the fund, and fund interest. One property could be in multiple funds, with different percentage but should add up to 100%
PropertyID | FundID | Fund Percentage |
---|---|---|
1 | A | 60% |
1 | B | 40% |
2 | B | 100% |
Table A, where the Fund Type is not known. I'm trying to grab the Fund Type, where the percentage is largest for the property. In the example above, Property 1 belong primarily to Fund A, so the Fund type below would be Multi.
PropertyID | Fund Type |
---|---|
1 | ? |
2 | ? |
I have tried many different SQL commands I found on Google but maybe my direction is just not right. I have gotten as far as writing a SELECT for the above example so that the fund type turns out to be Multi for Property 1, but failed to write the UPDATE command on top of it. I'd appreciate any help - thank you!