Results 1 to 8 of 8

Thread: Join syntax

  1. #1
    Join Date
    Dec 2006
    Posts
    35

    Unanswered: Join syntax

    You guys helped me out about a year ago with a similar problem. Since then I made some changes and now am getting this error: "Msg 4104, Level 16, State 1, Line 5 The multi-part identifier "rc_yea.yesvoters" could not be bound."

    Can you spot the issue? Thanks in advance.

    Query:

    INSERT INTO dbo.RollCallsIND1112
    (district_id, member_name, RCID, result)
    SELECT dbo.Members.Dist, dbo.Members.AlphaShort, dbo.RollCalls.PKRCID, 'Y' AS Yea
    FROM dbo.Members INNER JOIN
    dbo.rollcalls ON rc_yea.yesvoters LIKE '%' + dbo.Members.AlphaShort + '%'

  2. #2
    Join Date
    Sep 2010
    Posts
    153
    where is the condition in ur query? look at the last line of ur query, you have written inner join but where is the conditon. Condition should be like table A inner join table B on tableA.xyz = tableB.xyz

    provide a condition in your query or a column / field which is common in both the tables.

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by smacky05 View Post
    Can you spot the issue?
    yup

    there is no rc_yea table in your query --
    Code:
    ...
      FROM dbo.Members 
    INNER 
      JOIN dbo.rollcalls 
        ON rc_yea.yesvoters LIKE '%' + dbo.Members.AlphaShort + '%'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Dec 2006
    Posts
    35

    Thanks

    How would one go about putting that table in there?

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by smacky05 View Post
    How would one go about putting that table in there?
    which table in where?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    Dec 2006
    Posts
    35

    rc_yea

    That's the table you said was missing from the query.

  7. #7
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by smacky05 View Post
    That's the table you said was missing from the query.
    that's an interesting interpretation

    maybe i should have said "there is no rc_yea table in your query so don't go referencing any columns in it..."
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  8. #8
    Join Date
    Dec 2006
    Posts
    35
    thanks for your help

Posting Permissions

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