Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006

    Question Unanswered: Query: inner joins on two columns.

    Any help with this would be much appreciated.
    My sql is fairly limited...

    I have 2 tables.

    Table1 = [id], [description]
    This is used as a 'lookup table'
    Example data =
    1, poor
    2, average
    3, good

    Table2 = [id], [workRelationship], [jobRelationship]

    Example data =
    342, 2, 1
    452, 1, 3

    Table 1 has a relationship to table 2 on [workRelationship] and [jobRelationship] on

    I'd like to form a select query that would return:
    Table2[id] , [workRelationship].description, [jobRelationship].description
    OR in laymans terms using data above:
    342, Average, Poor
    452, Poor, Good

    with [workRelationship] producing the description from Table1 and not a number.Any Help would be much appreciated.
    I have used an inner join but because there are two columns(workRelationship, jobRelationship) I only get one result.

    Last edited by grooverinthesouth; 09-27-06 at 08:34.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
         , wrkRel.description as wrkRel_descr
         , jobRel.description as jobRel_descr
      from Table2
      join Table1 as wrkRel
        on = Table2.workRelationship
      join Table1 as jobRel
        on = Table2.jobRelationship | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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