Link Question

G

Guest

I have a list of social security numbers within a table. I want to be able
to link them to another table that has a social security range and the state
in which they are from.

First Table (1 Field)
Social Security Number
011-123-4567

Second Table (2 Fields)
First three Digits State
001-003 New Hampshire
004-007 Maine

How can I create a link that will tell me of the 1000 plus social security
numbers I have who is from what state? Any ideas?
 
K

Ken Snell \(MVP\)

Your second table obviously is not a normalized data set, so my first
inclination is to try a non-equi-join between the two tables:

SELECT [First Table].[Social Security Number],
[Second Table].[State]
FROM [First Table] INNER JOIN
[Second Table] ON
Left([First Table].[Social Security Number], 3) >=
Left([Second Table].[First three digits], 3) AND
Left([First Table].[Social Security Number], 3) <=
Right([Second Table].[First three digits], 3);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top