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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|