The best way to explain this is with visuals I believe. So I am going to recreate my 2 tables below.
Table A (Trades)
Fund Number Fund Name State Status
9999 Hippo Fund MD Y
9998 Whale Fund WI Y
9998 Whale Fund MD N
Table B (State Status)
Fund Number MD WI MA NY
9999 Y Y Y N
9998 N Y N N
I have a Table A that is the trades that are processed in a day. Each trade has a fund number it was traded in, a fund name, and a state which the trade is originated from. I also have a Table B which is the master table of Fund Numbers and the 50 states in the US and if they are eligible to be traded in that state.
What I need is a way to look at the fund number in Table A and the State in Table A. Then using Table B it will return the value in Table B that correlates with the fund number and the state.
Example above being, Fund 9999 in MD (found in Table A) is according to Table B a Y for eligible. So I need that field to return a Y. In the next example Fund 9998 in WI (found in Table A) is according to Table B a Y for eligible. So I need that field to return a Y also. Finally for Fund 9998 in MD (found in Table A) is according to Table B a N for not eligible, So I need that field to return N.
I really have no idea where to begin solving this issue. I have some code written that performs a similar task, but I am looking for an easier way. Any suggestions would be helpful. Thanks!
Table A (Trades)
Fund Number Fund Name State Status
9999 Hippo Fund MD Y
9998 Whale Fund WI Y
9998 Whale Fund MD N
Table B (State Status)
Fund Number MD WI MA NY
9999 Y Y Y N
9998 N Y N N
I have a Table A that is the trades that are processed in a day. Each trade has a fund number it was traded in, a fund name, and a state which the trade is originated from. I also have a Table B which is the master table of Fund Numbers and the 50 states in the US and if they are eligible to be traded in that state.
What I need is a way to look at the fund number in Table A and the State in Table A. Then using Table B it will return the value in Table B that correlates with the fund number and the state.
Example above being, Fund 9999 in MD (found in Table A) is according to Table B a Y for eligible. So I need that field to return a Y. In the next example Fund 9998 in WI (found in Table A) is according to Table B a Y for eligible. So I need that field to return a Y also. Finally for Fund 9998 in MD (found in Table A) is according to Table B a N for not eligible, So I need that field to return N.
I really have no idea where to begin solving this issue. I have some code written that performs a similar task, but I am looking for an easier way. Any suggestions would be helpful. Thanks!