Well Can I do it in PHP?
I am using PHP5 and MySQL 4.1.21-standard
Main Topics
Browse All TopicsI have a table with two types of addresses and I want to run a query on them that looks like this:
SELECT Address1, Address2
FROM tblMaster
WHERE ((Address2 Is Not Null) AND (Address1 <> Address2));
The only problem is some of the addresses have added spaces and hyphens that cause false-positives :(
So I am looking for a way to compare the two w/out the additional spaces and hyphens (and other symbols)...
So I need a SQL query that will compare the two fields w/out spaces and symbols (JUST Alpha-Numeric characters).
Any idea's ?
Thanks,
-BassKozz
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You could do this in php.
I would use a regular expression that found all characters that were not alphanumeric
ie
not
[A-Z] [a-z] or [0-9]
and do a regular expression replace to replace those that meet the criteria with nothing.
I'd then use php to dump these results into a temporary table - and then run your query from there (that would be the fastest way)
Business Accounts
Answer for Membership
by: Raynard7Posted on 2006-12-12 at 14:15:22ID: 18126430
Hi,
This depends on what version of mysql you are using.
If I were doing this with mysql 5.0 I would be building a function that cycles through all characters in the string and only return those that are alphanumeric - then doing a comparison using that function.
unfortunatley short of doing replaces on the other versions this is much harder to acheive.