473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

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

May 11 '07 #1
2 2078
On May 11, 4:23 pm, "pme...@yahoo.com" <pme...@yahoo.comwrote:
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

May 11 '07 #2
pm****@yahoo.com 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.
js*******@attglobal.net
==================
May 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Damian | last post by:
I was reading some old groups.google.com posts about css class names not being allowed underscores, but hyphens are? Why exactly did the writers/drafters of the spec think this was better then...
8
by: Earl Purple | last post by:
On VC++.NET it is implemented like this static int __cdecl compare ( const _Elem *_First1, const _Elem *_First2, size_t _Count ) { // compare [_First1, _First1 + _Count) with [_First2, ...)...
0
by: Veli-Pekka Tätilä | last post by:
Hi, My first post here. I've found some serious accessibility flaws in the Python 2.4 docs and wish they could be rectified over time. I'm very new to Python and initially contacted docs at python...
2
by: Zyron | last post by:
Hello! I'm developing a web page that has a goal of providing personal content, which means that all information should be written in their own language. I'm about to finish my Geo targeting...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
6
by: Maileen | last post by:
Hi, I have the following code : Function GetRequestType(ByVal EvDt As String, ByVal StPeriod As String, ByVal EdPeriod As String, ByVal TaskType As String) As Integer Dim strtest As String Dim...
0
by: Robin Munn | last post by:
I'm developing a simple proof-of-concept Web application, more as a personal programming exercise than anything else, that presents the user with a login form where they can type in a database...
3
by: John Salerno | last post by:
To test this out a wrote a little script as an exercise: for num in range(1, 10): x = 'c' * num y = 'c' * num if x is y: print 'x and y are the same object with', num, 'characters' else:...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.