SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot blackinwhite's Avatar
    Join Date
    Feb 2001
    Location
    Istanbul/Turkey
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL (INNER JOIN) question

    in this code,

    Code:
    strSql = "SELECT tblClippings.fldClippingID, tblTopics.fldTopicName, tblMessages.fldMessageID, tblMessages.fldMessageTitle, tblMessages.fldMessageCreated, tblPeople.fldPersonDisplayName, tblMessages.fldTopicID FROM tblTopics.fldTopicID INNER JOIN (tblPeople INNER JOIN (tblClippings INNER JOIN tblMessages tblClippings.fldB_MessageID = tblMessages.fldMessageID) ON tblPeople.fldMemberID = tblMessages.fldPersonID) ON tblTopics.fldTopicID = tblMessages.fldTopicID WHERE (tblClippings.fldB_MemberID=" & iPersonID & ")"
    after the FROM statement, I am getting confused. It gives error message.

    I think the problem is just about here,

    ...

    FROM tblTopics.fldTopicID INNER JOIN (tblPeople INNER JOIN (tblClippings INNER JOIN tblMessages tblClippings.fldB_MessageID =
    ...

  2. #2
    SitePoint Member
    Join Date
    Sep 2002
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You must remove fldTopicID from tblTopics.fldTopicID

    Look how it must work:

    strSql = "SELECT tblClippings.fldClippingID, tblTopics.fldTopicName, tblMessages.fldMessageID, tblMessages.fldMessageTitle, tblMessages.fldMessageCreated, tblPeople.fldPersonDisplayName, tblMessages.fldTopicID FROM tblTopics INNER JOIN (tblPeople INNER JOIN (tblClippings INNER JOIN tblMessages tblClippings.fldB_MessageID = tblMessages.fldMessageID) ON tblPeople.fldMemberID = tblMessages.fldPersonID) ON tblTopics.fldTopicID = tblMessages.fldTopicID WHERE (tblClippings.fldB_MemberID=" & iPersonID & ")"

    With best regards,
    Julia Pavlova
    Programmer
    Rapid Internet Development
    AlarIT Inc.
    URL: http://www.alarit.com

  3. #3
    SitePoint Zealot blackinwhite's Avatar
    Join Date
    Feb 2001
    Location
    Istanbul/Turkey
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    still not working

    gives error in FROM.

  4. #4
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're also missing an ON.

    Code:
    SELECT 	tblClippings.fldClippingID,
    	tblTopics.fldTopicName,
    	tblMessages.fldMessageID,
    	tblMessages.fldMessageTitle,
    	tblMessages.fldMessageCreated,
    	tblPeople.fldPersonDisplayName,
    	tblMessages.fldTopicID
    FROM 	tblTopics
    	INNER JOIN (tblPeople
    	INNER JOIN (tblClippings
    	INNER JOIN tblMessages 
    		ON tblClippings.fldB_MessageID = tblMessages.fldMessageID) 
    		ON tblPeople.fldMemberID 		= tblMessages.fldPersonID) 
    		ON tblTopics.fldTopicID 		= tblMessages.fldTopicID 
    WHERE (tblClippings.fldB_MemberID=" & iPersonID & ")"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •