Results 1 to 2 of 2

Thread: Need help with SQL query

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2006
    Location
    MI
    Posts
    2,012

    Need help with SQL query

    I need to write a query that gets 3 codes from a table & gets the definitions of the codes from 3 other tables, with 1 select statement.

    So for example, if I have "SELECT code1, code2, code3 FROM table1" and the definitions of code1 are in table2, code2 are in table3 & code3 are in table4, how can I write 1 query to get the definitions of code1, code2 & code3? Hopefully somebody understands what I mean. Thanks...

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Need help with SQL query

    Code:
    Select code1,code2,code3 From table1 
       Inner Join table1.code1 on table2.code1 
       Inner Join table1.code2 on table3.code2
       Inner Join table1.code3 on table4.code3
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

Posting Permissions

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



Click Here to Expand Forum to Full Width