I have 3 tables like in the examples shown below, in my MS Access database.
fruit_table
ID |fruit
---------------------
1 |Apple
2 |Orange
3 |Peach
4 |Banana
5 |Pear
6 |Grapes
7 |Lemon
8 |Watermellon
etc...
matching_table
matchID |statecode
----------------------
1 |5
1 |16
1 |21
2 |7
2 |27
3 |18
3 |3
3 |11
3 |5
3 |16
etc...
state_table
statecd |state
-----------------------
5 |MI
16 |WI
21 |OH
7 |FL
27 |CA
18 |IA
3 |MO
11 |IN
etc...
In the form view, I would like the user to scroll through every item in the fruit_table and have every matching item from the state_table listed in a large text field. Matching is done via the matching_table using the ID and statecode field which are both invisible to the user. Below is an example of what I want the user to see.
----------- ----------------------------
|Apple | |MI |
----------- |OH |
|WI |
| |
| |
----------------------------
----------- ----------------------------
|Orange | |CA |
----------- |FL |
| |
| |
| |
----------------------------
----------- ----------------------------
|Peach | |IA |
----------- |IN |
|MO |
|MI |
|WI |
----------------------------
What is the SQL query statement to accomplish this? I realize that I could have just used the state abreviations instead of the statecode and eliminated that table all together, but this is just an example. In reality I have millions of records in tables already set up similar to this (in structure) and want to work with what I have, not change the data.
Thank you,
Joe