Access string comparison

I need to compare data in two tables. Table 1 has the full, 9-digit social security number, but Table 2 only has the last four digits. I know I could extract the last four digits of the first table in Excel using Text to Columns, but it seems like there would be a way to do this when I create the subset of data for Table 1. I'm not real fluent in SQL, but understand the principles. This will be used on a monthly basis verify vendor statements, so I'd like to automate as much as possible now.

Appreciate an answer to this one.

Cathy
pcladylrAsked:
Who is Participating?
 
FlysterConnect With a Mentor Commented:
You can use the Right function on the table 1 field:

Right(9-Digit SSN,4)

You can then compare that to Table 2

Flyster
0
 
Rey Obrero (Capricorn1)Commented:
you can do this in access using a query like this

select table1.*,  table2.*
from table1, table2
where right([Table1].[ssn],4)=table2.[ssn]
0
 
pcladylrAuthor Commented:
I chose your answer because it shows me how to create this four-digit field in the initial query where I am creating Table 1.

Thank you!
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Rey Obrero (Capricorn1)Commented:
pcladylr,

the query i posted gives you what you are looking for..
0
 
pcladylrAuthor Commented:
And, thanks to both of you for responding so quickly.
0
 
pcladylrAuthor Commented:
Capricorn1: Sorry, I just now saw your comment and realize that you indeed did provide the correct answer. I'm not very SQL literate and didn't recognize it. You certainly deserve points. Is there a way I can remedy this? Thank you.
0
 
FlysterCommented:
I have no problems with splitting points. I forgot to refresh and didn't see Capricorn1's response!
0
 
pcladylrAuthor Commented:
Thanks, Flyster. How do I go about doing that?
0
 
FlysterCommented:
That's new territory for me. I would try the request attention link under your original post. That will get to one of the moderators.
0
All Courses

From novice to tech pro — start learning today.