Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2008
    Posts
    55

    Unanswered: Multiple Inner Joins Question

    Hello,

    I am new to SQL server. I am trying to use multiple inner joins to retrieve data from 3 tables. Here is the code but it's not working:

    select a.entityid,
    b.spechndl,
    a.solicode,
    x.solicode
    from tb978 a
    inner join tb978 x on a.entityid = x.entityid
    and a.solicode = 'udvpp'
    and x.solicode like 'udva%'
    inner join tb949 b on a.entityid = b.entityid
    and b.spechndl in ('myp', 'nlp');


    Here is the error I am getting:

    Msg 207, Level 16, State 1, Line 9
    Invalid column name 'entityid'.


    Thank you for any input!
    Kevin

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Why are you joining tb978 to itself?
    George
    Home | Blog

  3. #3
    Join Date
    Aug 2008
    Posts
    55
    Quote Originally Posted by georgev
    Why are you joining tb978 to itself?
    because i want to show the two different 'solicode' side by side.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I'm gonna go out on a limb and suggest tb978 or tb949 don't have a column called entityid.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    is there an entityid column in both tables? tb978 and tb949? if not there's the reason for the error.

  6. #6
    Join Date
    Aug 2008
    Posts
    55
    you guys are right. tb949 doesn't have entityid. I should have looked more closely...
    Thank you.

Posting Permissions

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