On Feb 2, 2009, at 1:41 PM, Christoph Boget wrote:
I was wondering if something was possible, I have an excel file
right now of
US mailing addresses, and what I need to do is select all the odd
numbered
addresses on one road, is there an easy way I can do that from
MySQL? the
addresses could contain 3, 4 or 5 numbers per addresses such as:
123 Main
1232 Main
1233 Main
1234 Main
12345 Main
and what I want out of those would be:
1232 Main
1234 Main
Any ideas? Thanks for looking! :)
Well, if this is something you will be doing a lot, the most efficient
way to store the addresses would be to have separate columns for the
house number and the street name. Doing that will allow you to run a
query as simple as:
SELECT * FROM Addresses WHERE (house_number % 2) == 0;
If you can't (or don't want to) have separate columns, you can use a
regular expression to pull out the house number then operating on it
as above. You can read more about mysql and regular expressions
here:
http://dev.mysql.com/doc/refman/5.0/en/regexp.html
Hi Chris,
Thanks for the info, I had thought about splitting it but wanted to
see if there was a better/different way. Right now this is a one
time thing, but if it works well it's something that could turn into
a regular thing for me to do.
Thanks again!
--
Jason Pruim
japr...@raoset.com
616.399.2355