Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unmatched query, strip part of matching field?

Status
Not open for further replies.

lorirobn

MIS
Mar 15, 2005
450
US
Hi -
I am creating an Unmatched query, and the field in common on the two tables is email address.
However, on one table, the address is kept in full ("JohnSmith@abc.com"). On the other table, address is kept without the domain name ("JohnSmith").

Can I write my query around this? Is there a way to strip everything from the "@" on during the query?

My query now (which doesn't work, because it compares the two unequal fields) is:
Code:
SELECT Accounts.ID, Accounts.username
FROM Accounts LEFT JOIN STAFF  ON Accounts.username = STAFF.email
WHERE (((STAFF.email) Is Null));
Accounts is the table without domain name; STAFF is the table with domain name.

Thanks in advance for any help.
Lori
 
You may try this:
FROM Accounts LEFT JOIN STAFF ON STAFF.email Like Accounts.username & '@*'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for your quick responses!
I tried PH's, and it worked great. And now I know how to append and also do a "wild card".
Thanks rjoubert, too - I will try this another time, just to learn some more.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top