Hi,
I have 2 tables, in the first table (test1) I have ID1, ID2, ID3, ID4, and ID5. The second table (test2)I have ID and State. What I would like to do is to get the state associated with each ID for each field. For example, if ID1 = "IL", ID2 = "IN", ID3 = "CA", ID4 = "NV", and ID5 = "NY", I would like to get Illinois, Indiana, California, Nevada, and New York. The field ID in test2 has all the state abbreviations and the state field has the state spelled out, ID1 - ID5 has the state abbreviations or a blank. I have tried the following with no luck:
SELECT id as id_1, id as id_2, id as id_3, id as id_4, id as id_5, id1, id2, id3, id4, id5
FROM test1, test2
WHERE id_1 = id1 AND id_2 = id2 AND id_3 = id3 AND id_4 = id4 AND id_5 = id5
I am not sure that this is even the right approach. Has anyone done anything similar to this? If so, what did you do?
Thanks,
Mark
I have 2 tables, in the first table (test1) I have ID1, ID2, ID3, ID4, and ID5. The second table (test2)I have ID and State. What I would like to do is to get the state associated with each ID for each field. For example, if ID1 = "IL", ID2 = "IN", ID3 = "CA", ID4 = "NV", and ID5 = "NY", I would like to get Illinois, Indiana, California, Nevada, and New York. The field ID in test2 has all the state abbreviations and the state field has the state spelled out, ID1 - ID5 has the state abbreviations or a blank. I have tried the following with no luck:
SELECT id as id_1, id as id_2, id as id_3, id as id_4, id as id_5, id1, id2, id3, id4, id5
FROM test1, test2
WHERE id_1 = id1 AND id_2 = id2 AND id_3 = id3 AND id_4 = id4 AND id_5 = id5
I am not sure that this is even the right approach. Has anyone done anything similar to this? If so, what did you do?
Thanks,
Mark