Compare Two Names Based on Characters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pmelan@yahoo.com

    Compare Two Names Based on Characters

    Hi everyone.

    I wasn't sure how to describe what I want in the subject line so
    hopefully this post will allow me to further explain. I have a table
    where I have names of people who have filed evictions against their
    tenants. These plaintiffs have no mailing street addres. They have a
    city, state, and zip code. In another table, I have a massive listing
    of those plaintiffs who have filed evictions against their tenants but
    each record includes a full mailing address; street, city, state, and
    zip.

    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.

    Any ideas??

    Thanks in advance.

    Peter Melan

  • Mike P2

    #2
    Re: Compare Two Names Based on Characters

    On May 11, 4:23 pm, "pme...@yahoo.c om" <pme...@yahoo.c omwrote:
    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

    Comment

    • Jerry Stuckle

      #3
      Re: Compare Two Names Based on Characters

      pmelan@yahoo.co m wrote:
      Hi everyone.
      >
      I wasn't sure how to describe what I want in the subject line so
      hopefully this post will allow me to further explain. I have a table
      where I have names of people who have filed evictions against their
      tenants. These plaintiffs have no mailing street addres. They have a
      city, state, and zip code. In another table, I have a massive listing
      of those plaintiffs who have filed evictions against their tenants but
      each record includes a full mailing address; street, city, state, and
      zip.
      >
      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.
      >
      Any ideas??
      >
      Thanks in advance.
      >
      Peter Melan
      >
      Peter,

      I wouldn't even do it in PHP. I'd just use SQL. Check
      comp.databases. mysql (or whatever database you're using) for a
      SQL-specific answer to your problem.


      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      Working...