I have two independently built tables of people. I am trying to match
people from one with people from the other. The problem is that in one
table they may have used "Ron" and in the other "Ronald". What I want
to do is have a match if on something like "if 'Ronald" is like 'Ron%'
but obviously for any name that could appear. I know this won't help in
cases like Bill and William but it's better than nothing. The first
query below is the one I thought would do the trick and the second one
is setup for the specific case I know exists to test the general idea.
The second one works but isn't very useful. Can someone tell me how to
make the first one work?
The example I have has 'Ron' in the 'h' table and 'Ronald' in the 'm'
table. With a last name of Gibson. In general the short name could be
in either table.
This runs but I get no results.
SELECT (@hname:=h.FName) as hFName, (@mname:=m.FName) as mFName,
m.LName, m.Phone
FROM m, h
WHERE m.LName = h.LName AND
(
(h.FName like concat(@mname, '%') AND m.FName = @mname)
OR (m.FName like concat(@hname, '%') AND h.FName = @hname)
)
SELECT `Call`, (@hname:=h.FName) as hFName, (@mname:=m.FName) as mFName,
m.LName, m.Street1, m.Phone
FROM m, h
WHERE h.LName = 'Gibson' AND m.LName = h.LName AND
(
OR (m.FName like 'Ron%' AND h.FName = 'Ron')
)
--
Chris W
KE5GIX
Gift Giving Made Easy
Get the gifts you want &
give the gifts they want
One stop wish list for any gift,
from anywhere, for any occasion!
http://thewishzone.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]