Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303

    Unanswered: 3 tables to join

    hi,
    I knew how to join 2 tables but i have a process to select 3 tables. I have a sample table and field below. I want to join Parts & Orders using field Prt_no and Supplier & Parts using field Sup _code



    Parts table Orders Table Supplier Table
    Prt_no Prt_no Sup_code
    Prt_name Oh_qt Sup_name
    Re_Level Or_no
    Pri_amnt
    Sup_code

    Thanks...

  2. #2
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    SELECT
    p.Prt_no,
    o.Prt_no,
    s.Sup_code,
    p.Sup_code
    FROM
    Parts p
    INNER JOIN Orders o ON p.Prt_no = o.Prt_no
    INNER JOIN Supplier s ON p.Sup_code = s.Sup_code

    --I would invest in a good TSQL book if I were you. Teach Yourself Transact-SQL in 21 Days by Sam's Publishing is really good for beginners.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  3. #3
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303
    Where I can get that book?

Posting Permissions

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