You are here: Re: Compare Two Names Based on Characters « PHP Programming Language « IT news, forums, messages
Re: Compare Two Names Based on Characters

Posted by Mike P2 on 05/11/07 20:43

On May 11, 4:23 pm, "pme...@yahoo.com" <pme...@yahoo.com> wrote:
> What I'm trying to figure out is how to write a little PHP program to
> compare the name fields of table 1 (without address) into table 2
> (with addresses) and replace the address in table 1 with the address
> from table 2 based on the match. I would also like the capability to
> match combined fields from table 1 into table 2, meaning, if I were to
> combine name, city, state, and zip in table 1 and combine name, city,
> state, zip in table 2, I will most likely have the ability to reduce
> the list.

Assuming you're using MySQL, you can probably do that all in one
query. Here's an example:

CREATE TABLE `table3`
(
SELECT *
FROM
`table1` AS `t1`
INNER JOIN
`table2` AS `t2`
ON
`t1`.`name` = `t2`.`name`
)

That should create a table that is a combination of the first two,
combining based on the `name` field. You might want a much more
complicated script that will ask you what to do when the other fields
in the two tables do not match.

Also, the first table (without an address) should not have a field for
the address to make sure the empty one does not overwrite the one with
the data.

-Mike PII

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация