dbTalk Databases Forums  

INNER JOIN question

comp.database.ms-access comp.database.ms-access


Discuss INNER JOIN question in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Steve
 
Posts: n/a

Default INNER JOIN question - 02-25-2005 , 03:37 AM






Hi,

I am real new to databases and hoping someone can help.

Main-table is a huge spreadsheet that I imported into Access
Site-table has a bunch of addresses pulled from Main-table, quite a few
overlap in some areas and none of the fields are unique except the
AddressKey which I created after pulling data from the Main-table. Why some
fields are not unique I won't get into.

what I currently have.....
UPDATE [Main-table]
INNER JOIN [Main-table].[AddressLine01]=[Sites-table].[AddressLine01]
SET [Main-table].Addressfkey = [Sites-table].[AddressKey];


I have now created a colum in the Main-table called Addressfkey which I
would like to correlate to the AddressKey in Sites-table. Since none of the
fields are unique in Sites-table, is there a way to modify the following so
that I can INNER JOIN based on more than one field? Currently I use
[Main-table].[AddressLine01]=[Sites-table].[AddressLine01] but this doesnt
get specific enough, for example , how could I work in the equivalent of
INNER JOIN [Sites-table] ON
[Main-table].[AddressLine02]=[Sites-table].[AddressLine02]
so that if two fields in the inner join matches, then it performs the SET



Or, is there a different batch of commands altogether



Thanks....Steve




Reply With Quote
  #2  
Old   
MGFoster
 
Posts: n/a

Default Re: INNER JOIN question - 02-25-2005 , 01:32 PM






Steve wrote:
Quote:
Hi,

I am real new to databases and hoping someone can help.

Main-table is a huge spreadsheet that I imported into Access
Site-table has a bunch of addresses pulled from Main-table, quite a few
overlap in some areas and none of the fields are unique except the
AddressKey which I created after pulling data from the Main-table. Why some
fields are not unique I won't get into.

what I currently have.....
UPDATE [Main-table]
INNER JOIN [Main-table].[AddressLine01]=[Sites-table].[AddressLine01]
SET [Main-table].Addressfkey = [Sites-table].[AddressKey];


I have now created a colum in the Main-table called Addressfkey which I
would like to correlate to the AddressKey in Sites-table. Since none of the
fields are unique in Sites-table, is there a way to modify the following so
that I can INNER JOIN based on more than one field? Currently I use
[Main-table].[AddressLine01]=[Sites-table].[AddressLine01] but this doesnt
get specific enough, for example , how could I work in the equivalent of
INNER JOIN [Sites-table] ON
[Main-table].[AddressLine02]=[Sites-table].[AddressLine02]
so that if two fields in the inner join matches, then it performs the SET
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

UPDATE [Main-table] As M INNER JOIN [Sites-table] AS S
ON M.[AddressLine01] = S.[AddressLine01]
AND M.[AddressLine02] = S.[AddressLine02]

SET M.Addressfkey = S.[AddressKey]

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQh99AYechKqOuFEgEQIonQCgoVlbVRedYLZpGqTqQgwiO4 qPS+QAnAi0
PXQsS3VvKeWPJUAJ4oKBqaV5
=FQUN
-----END PGP SIGNATURE-----


Reply With Quote
  #3  
Old   
Alan Webb
 
Posts: n/a

Default Re: INNER JOIN question - 02-26-2005 , 08:56 PM



Steve,
Yes, in short. JOINS are a big subject in SQL. You can do a lot that isn't
directly supported through the QBE grid in Access. My favorite IT book
publisher, O'Reilly, publishes an SQL pocket guide that documents lots of
neat tricks and it's under $20.00. I don't work for them or get compensated
for plugging a book in any way. I just like the book and think you would
benefit from buying it.

"Steve" <1@2.com> wrote

Quote:
Hi,

I am real new to databases and hoping someone can help.

Main-table is a huge spreadsheet that I imported into Access
Site-table has a bunch of addresses pulled from Main-table, quite a few
overlap in some areas and none of the fields are unique except the
AddressKey which I created after pulling data from the Main-table. Why
some
fields are not unique I won't get into.

what I currently have.....
UPDATE [Main-table]
INNER JOIN [Main-table].[AddressLine01]=[Sites-table].[AddressLine01]
SET [Main-table].Addressfkey = [Sites-table].[AddressKey];


I have now created a colum in the Main-table called Addressfkey which I
would like to correlate to the AddressKey in Sites-table. Since none of
the
fields are unique in Sites-table, is there a way to modify the following
so
that I can INNER JOIN based on more than one field? Currently I use
[Main-table].[AddressLine01]=[Sites-table].[AddressLine01] but this doesnt
get specific enough, for example , how could I work in the equivalent of
INNER JOIN [Sites-table] ON
[Main-table].[AddressLine02]=[Sites-table].[AddressLine02]
so that if two fields in the inner join matches, then it performs the SET



Or, is there a different batch of commands altogether



Thanks....Steve






Reply With Quote
  #4  
Old   
Steve
 
Posts: n/a

Default Re: INNER JOIN question - 02-27-2005 , 05:10 AM



thanks alot, worked like a charm'


"MGFoster" <me (AT) privacy (DOT) com> wrote

Quote:
Steve wrote:
Hi,

I am real new to databases and hoping someone can help.

Main-table is a huge spreadsheet that I imported into Access
Site-table has a bunch of addresses pulled from Main-table, quite a few
overlap in some areas and none of the fields are unique except the
AddressKey which I created after pulling data from the Main-table. Why
some
fields are not unique I won't get into.

what I currently have.....
UPDATE [Main-table]
INNER JOIN [Main-table].[AddressLine01]=[Sites-table].[AddressLine01]
SET [Main-table].Addressfkey = [Sites-table].[AddressKey];


I have now created a colum in the Main-table called Addressfkey which I
would like to correlate to the AddressKey in Sites-table. Since none of
the
fields are unique in Sites-table, is there a way to modify the following
so
that I can INNER JOIN based on more than one field? Currently I use
[Main-table].[AddressLine01]=[Sites-table].[AddressLine01] but this
doesnt
get specific enough, for example , how could I work in the equivalent of
INNER JOIN [Sites-table] ON
[Main-table].[AddressLine02]=[Sites-table].[AddressLine02]
so that if two fields in the inner join matches, then it performs the
SET

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

UPDATE [Main-table] As M INNER JOIN [Sites-table] AS S
ON M.[AddressLine01] = S.[AddressLine01]
AND M.[AddressLine02] = S.[AddressLine02]

SET M.Addressfkey = S.[AddressKey]

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQh99AYechKqOuFEgEQIonQCgoVlbVRedYLZpGqTqQgwiO4 qPS+QAnAi0
PXQsS3VvKeWPJUAJ4oKBqaV5
=FQUN
-----END PGP SIGNATURE-----



Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.