A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Inner Join SQL Help



 
 
Thread Tools Display Modes
  #1  
Old July 15th, 2008, 06:16 PM posted to microsoft.public.access.queries
Ray Todd Jr
external usenet poster
 
Posts: 24
Default Inner Join SQL Help

I'm trying to join two tables via SQL and am getting errors. Any help is
appreciated.

The tables:

taDEFENDANTS
DefendantsID PK
PropertyID FK
DefendantsNameID FK
DefendantType FK

TaDEFENDANTNAMES
DefendantsNameID PK
LastName
FirstName
MiddleName
Suffix

The SQL:

SELECT DISTINCT taProperty.PropertyID, CONCATENATE("SELECT FirstName & ' ' &
MiddleName & ' ' & LastName & ' ' & Suffix, DefendantsNameID FROM
taDEFENDANTNAMES INNERJOIN taDEFENDANTS ON
taDEFENDANTNAMES.DefendantsNameID=taDEFENDANTS.Def endantsNameID WHERE
PropertyID=" & taProperty.PropertyID & " AND DefendantTypeID=20") as
Property_Owner FROM taPROPERTY

The Error:

Run-Time Error: 3131
Syntax Error in FROM Clause



  #2  
Old July 15th, 2008, 08:00 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Inner Join SQL Help

INNERJOIN should be INNER JOIN
Other than that, I don't see anything else wrong as long as PropertyID is a
number field and is a field in ONE of the two tables.

SELECT DISTINCT taProperty.PropertyID
, CONCATENATE("SELECT FirstName & ' ' & MiddleName & ' ' & LastName & ' ' &
Suffix, DefendantsNameID
FROM taDEFENDANTNAMES INNER JOIN taDEFENDANTS ON
taDEFENDANTNAMES.DefendantsNameID=taDEFENDANTS.Def endantsNameID
WHERE PropertyID=" & taProperty.PropertyID & " AND DefendantTypeID=20") as
Property_Owner FROM taPROPERTY


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

Ray Todd Jr wrote:
I'm trying to join two tables via SQL and am getting errors. Any help is
appreciated.

The tables:

taDEFENDANTS
DefendantsID PK
PropertyID FK
DefendantsNameID FK
DefendantType FK

TaDEFENDANTNAMES
DefendantsNameID PK
LastName
FirstName
MiddleName
Suffix

The SQL:

SELECT DISTINCT taProperty.PropertyID, CONCATENATE("SELECT FirstName & ' ' &
MiddleName & ' ' & LastName & ' ' & Suffix, DefendantsNameID FROM
taDEFENDANTNAMES INNERJOIN taDEFENDANTS ON
taDEFENDANTNAMES.DefendantsNameID=taDEFENDANTS.Def endantsNameID WHERE
PropertyID=" & taProperty.PropertyID & " AND DefendantTypeID=20") as
Property_Owner FROM taPROPERTY

The Error:

Run-Time Error: 3131
Syntax Error in FROM Clause



  #3  
Old July 15th, 2008, 08:53 PM posted to microsoft.public.access.queries
Ray Todd Jr
external usenet poster
 
Posts: 24
Default Inner Join SQL Help

Hello John:

Thanks for the help. Apparently, I didn't look close enough and there
wasn't a space between Inner and Join.

Again thanks...

"John Spencer" wrote:

INNERJOIN should be INNER JOIN
Other than that, I don't see anything else wrong as long as PropertyID is a
number field and is a field in ONE of the two tables.

SELECT DISTINCT taProperty.PropertyID
, CONCATENATE("SELECT FirstName & ' ' & MiddleName & ' ' & LastName & ' ' &
Suffix, DefendantsNameID
FROM taDEFENDANTNAMES INNER JOIN taDEFENDANTS ON
taDEFENDANTNAMES.DefendantsNameID=taDEFENDANTS.Def endantsNameID
WHERE PropertyID=" & taProperty.PropertyID & " AND DefendantTypeID=20") as
Property_Owner FROM taPROPERTY


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

Ray Todd Jr wrote:
I'm trying to join two tables via SQL and am getting errors. Any help is
appreciated.

The tables:

taDEFENDANTS
DefendantsID PK
PropertyID FK
DefendantsNameID FK
DefendantType FK

TaDEFENDANTNAMES
DefendantsNameID PK
LastName
FirstName
MiddleName
Suffix

The SQL:

SELECT DISTINCT taProperty.PropertyID, CONCATENATE("SELECT FirstName & ' ' &
MiddleName & ' ' & LastName & ' ' & Suffix, DefendantsNameID FROM
taDEFENDANTNAMES INNERJOIN taDEFENDANTS ON
taDEFENDANTNAMES.DefendantsNameID=taDEFENDANTS.Def endantsNameID WHERE
PropertyID=" & taProperty.PropertyID & " AND DefendantTypeID=20") as
Property_Owner FROM taPROPERTY

The Error:

Run-Time Error: 3131
Syntax Error in FROM Clause




 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:11 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.