Richard Kreidl
asked on
Compare only last 4 characters of phone number in SQL query
I have the following SQl query I'm running against two tables in an Access 2007 database:
SELECT ContactPhone.Item_ID, ContactPhone.Last_Name, ContactPhone.First_Name, ContactPhone.Work_Phone, ContactPhone.[1st_Choice], ContactPhone.[2nd_Choice], ContactPhone.[3rd_Choice], ContactPhone.Comments
FROM ContactPhone LEFT JOIN onlyDCS ON ContactPhone.Work_Phone=on lyDCS.Work _Phone
WHERE (((onlyDCS.Work_Phone) Is Null));
I want to just use a substring compare of the last four character of the "Work_Phone" from both tables.
example of the Work_Phone data
555-1234
just need to compare
1234
Thanks!!
SELECT ContactPhone.Item_ID, ContactPhone.Last_Name, ContactPhone.First_Name, ContactPhone.Work_Phone, ContactPhone.[1st_Choice],
FROM ContactPhone LEFT JOIN onlyDCS ON ContactPhone.Work_Phone=on
WHERE (((onlyDCS.Work_Phone) Is Null));
I want to just use a substring compare of the last four character of the "Work_Phone" from both tables.
example of the Work_Phone data
555-1234
just need to compare
1234
Thanks!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
select * from ContactPhone
where right([ContactPhone ].[Work_Phone],4)=right([o