Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

Inner Join Syntax  Problems

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Wetmore - 28 Apr 2008 01:20 GMT
I am beginning the construction of a minimal search via SQL involving three sets of search terms.
The three sets of search terms are each M2M with the main table (tblHeaders) through link tables.
I have SQL statements which return the hits on each set of search terms.

I am assuming than the inner join of the three sets will give me a minimal set of hits.
I am trying to build the SQL statement sequetially, beginning with the first set of search terms which has tblQuads.Join
as the link table. The SQL with the first set is:

SELECT thlHeaders.HKey, tblHeaders.Name FROM tblHeaders
INNER JOIN
SELECT HKey FROM tblHeaders
WHERE (tblHeaders.HKey  
IN
(SELECT PKey AS HKey
FROM tblQuadsJoin
WHERE (((tblQuadsJoin.CKey)=59))))
ON tblHeaders.HKey = HKey)

I have tested the nested SELECT clause with a recordset, and it retrieves the proper HKey values from tblHeaders.

I am getting a syntax error in the FROM clause. Am I missing some parentheses, or is it a more fundamental issue?
(SQL reminds me of LISP!)

Thanks, Dave
Dale Fye - 28 Apr 2008 01:33 GMT
David,

It looks like you are trying to get the HKey and Name from tblHeaders, where
the PKey in tblQuadsJion matches the HKey in tblHeaders, and where the CKey
in tblQuadsJoin = 59.  If so, a simpler SQL would look like:

SELECT tblHeaders.HKey, tblHeaders.Name
FROM tblHeaders
INNER JOIN tblQuadsJoin
ON tblHeaders.HKey = tblQuadsJoin.PKey
WHERE tblQuadsJoin.CKey = 59

HTH
Dale

>I am beginning the construction of a minimal search via SQL involving three
>sets of search terms.
[quoted text clipped - 26 lines]
>
> Thanks, Dave
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.