Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Posts
    4

    Unanswered: JOIN with nested Table

    I get a "missing keyword" error whenever I run the following query:

    SELECT chr_ID, chr_IndID
    FROM tbl_Indicators LEFT JOIN (
    SELECT chr_IndID
    FROM tbl_Ratings
    WHERE chr_Employee = 'Name'
    ) AS tbl_EmployeeRatings
    ON tbl_Indicators.chr_ID = tbl_EmployeeRatings.chr_IndID
    WHERE chr_CompID = 'ID-1' AND chr_Group = 'group'
    ORDER BY int_Order;


    This works fine:

    SELECT chr_ID, chr_IndID
    FROM tbl_Indicators LEFT JOIN tbl_Ratings
    ON tbl_Indicators.chr_ID = tbl_Ratings.chr_IndID
    WHERE chr_CompID = 'ID-1' AND chr_Group = 'group'
    ORDER BY int_Order;


    And this works fine:

    SELECT chr_IndID
    FROM tbl_Ratings
    WHERE chr_Employee = 'Name'


    Table Structures:

    tbl_Ratings { chr_IndID, chr_Employee }
    tbl_Indicators { chr_ID, chr_CompID, int_Order, chr_Group, chr_Proficiency }

    However when I try to nest query 2 into query 1 I get the "missing keyword" error. Can anybody help me?
    Last edited by Chocoholic; 08-27-07 at 04:25.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    I think the AS keyword ("AS tbl_EmployeeRatings") after the inline view is not allowed.

  3. #3
    Join Date
    Aug 2007
    Posts
    4
    Thanks for that

    Removed "AS" and it works fine

    Much appreciated.

Posting Permissions

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