Chat with a LIVE Microsoft Access Expert!
 
       
 

         

   

Go Back   Access World Forums > Microsoft Access Discussion > Queries

 
 
Chat with a LIVE Microsoft Access Expert!
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-05-2007, 10:29 AM
ScottW ScottW is offline
Registered User
 
Join Date: Feb 2007
Location: Ohio
Posts: 4
ScottW is on a distinguished road
Help searching one column against another

I am new here. I need a little direction on the right path to take. My background is RPG programming so I am very shakey when it comes to SQL and Access DB.

I have two spreadsheets I am importing into a Access DB. These two spreadsheets have lists of first and last names.

I need to treat one as the "master" listing of names and take the other table and search against the master looking for occurences of the names. To start out, I will just try to match last name against last name. The only catch is the first and last names are all together in one column in each table.

So, what I think I am looking for is a way to take a character string and search another table column for the same character string.

For example:
Let's say the "master" table has a column for name and one of the rows is Duck, Donald. The second table has a name in a row Duck, Buford. I would want to take the string of "Duck" and search the master table for "Duck."

I guess I could do this because the first and last names are seperated by a comma. The reason for not searching for the entire first and last name is because most of the time they do not match exactly. There may be a middle initial or maybe the first name was mispelled. Anyway, I am looking to strip out the last name and search for it in another table.

Where would you suggest I start looking?

Thank you.
Scott
Reply With Quote
Sponsored Links
  #2  
Old 02-05-2007, 11:59 AM
FoFa's Avatar
FoFa FoFa is offline
Registered User
 
Join Date: Jan 2003
Location: Texas, USA
Posts: 3,665
FoFa is on a distinguished road
I would create two new fields in each table lest call them lastName and FirstName. Then parse the name field into those.
UPDATE MyTable
SET [LastName] = LEFT([FullName],instr([FullName],',')-1)

and

UPDATE MyTable
SET [FirstName] = RIGHT([FullName],LEN([FullName]) - instr([FullName],','))

Basically, may need to adjust slightly
Then you can match on different columns instead.
__________________
E Pluribus Unum - Out of Many, One
Reply With Quote
  #3  
Old 02-05-2007, 12:05 PM
ScottW ScottW is offline
Registered User
 
Join Date: Feb 2007
Location: Ohio
Posts: 4
ScottW is on a distinguished road
Quote:
Originally Posted by FoFa
I would create two new fields in each table lest call them lastName and FirstName. Then parse the name field into those.
UPDATE MyTable
SET [LastName] = LEFT([FullName],instr([FullName],',')-1)

and

UPDATE MyTable
SET [FirstName] = RIGHT([FullName],LEN([FullName]) - instr([FullName],','))

Basically, may need to adjust slightly
Then you can match on different columns instead.
Thank you FoFa. This heads me in the right direction. I am kind of going in 100 diffent directions and this truly helps me. Thank you again!!!
Scott
Reply With Quote
  #4  
Old 02-08-2007, 07:43 AM
ScottW ScottW is offline
Registered User
 
Join Date: Feb 2007
Location: Ohio
Posts: 4
ScottW is on a distinguished road
Quote:
Originally Posted by FoFa
I would create two new fields in each table lest call them lastName and FirstName. Then parse the name field into those.
UPDATE MyTable
SET [LastName] = LEFT([FullName],instr([FullName],',')-1)

and

UPDATE MyTable
SET [FirstName] = RIGHT([FullName],LEN([FullName]) - instr([FullName],','))

Basically, may need to adjust slightly
Then you can match on different columns instead.
I am stuck. Where do I put in the "update" statements above? I tried the SQL view but it doesn't pull the data from the column as I expected. Instead it is prompting me for a value.

What could I be missing?

Thank you.
Reply With Quote
  #5  
Old 02-08-2007, 09:08 AM
ScottW ScottW is offline
Registered User
 
Join Date: Feb 2007
Location: Ohio
Posts: 4
ScottW is on a distinguished road
Never mind. I finally figured it out. I am stumbing though this. I didn't know I just needed to execute the query to get the table updated. It is working absolutely perfectly.......

THANK YOU.
Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Indexes WindSailor Theory and practice of database design 4 08-23-2006 10:30 PM
Clustered Indexes WindSailor Theory and practice of database design 0 03-10-2006 08:28 PM
Combo Bound Column to Word Bookmark Conflict andysgirl8800 Forms 1 07-06-2005 11:34 AM
Combo box column display stephen81 Forms 4 01-27-2004 03:41 AM
running total in a column MJ7 Reports 1 08-04-2002 08:06 PM


All times are GMT -8. The time now is 10:01 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) copyright 2009 Access World