I'm working in Access 2013 with Microsoft's SQL. Currently, I have three separate tables. One has a field [name] that is a number, table2 has a field with people's names [name] and a primary key for each name, and table3 is the same as table1 except that it's [name] field has the people's names from table2 as Short Text). I want to use [name] in table3 as a reference, so that I can put the corresponding ID number from table2 into table1.name. Is this possible, and if so how should I go about this? Hoping to write an SQL query.
table1
id | name (number)| other |
---------------------------
1 | | ... |
2 | | ... |
3 | | ... |
table2
id | name (number)|
-------------------
10 | person1
20 | person2
30 | person3
table3
id | name (short text)| other |
---------------------------
1 | person2 | ... |
2 | person3 | ... |
3 | person1 | ... |
Basically, my goal here is to populate table1.name with a corresponding table2.id when table3.name = table2.name. For instance table1 row 1 has person2, so the person2 id will appear in the corresponding table1 row (where table1.id = table2.id). Sorry if I've done a poor job trying to explain this in writing!
Also, would it be easier to do this with 2 tables instead? Possibly have just table3 and replace the table3.name with values from table2.id when table2.name = table3.name. Although it would be putting a number in a field with datatype Short Text, not sure if this may cause issues. Thank you for any help!
field_1
that is supposed to beid
I assume? – Tanner