Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Posts
    102

    Unanswered: Joining on more than 1 field ??

    Hi,

    Is it possilbe to join 2 tables on more than one field ?


    Like

    SELECT *
    FROM tblONE A JOIN tblTWO B ON
    (a.one = b.one AND a.two = b.two AND a.three = c.three);


    I tried this and would not run.

    ANy suggestions ?

  2. #2
    Join Date
    Sep 2003
    Location
    London
    Posts
    56
    What was the error?

    Are table names case sensitive in SQL Server? If so, you may need to edit your alias'.

    Matt.

  3. #3
    Join Date
    Sep 2003
    Posts
    102
    Originally posted by Mincer
    What was the error?

    Are table names case sensitive in SQL Server? If so, you may need to edit your alias'.

    Matt.
    Oh

    thanks..
    must've just mistyped...
    tired =)

    thanks again..

    u have any suggestions for my other post 'finding distinct combinations'

    http://dbforums.com/t916080.html

  4. #4
    Join Date
    May 2003
    Posts
    26
    SELECT *
    FROM tblONE A JOIN tblTWO B ON
    (a.one = b.one AND a.two = b.two AND a.three = c.three);
    You're referencing an alias 'c' ... 'a.three = c.three' that you haven't created. Should it be 'b' instead? I don't think case is an issue with an Alias, and I don't think you need the parens either.

Posting Permissions

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