How to fix ambiguous column error?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spaz2k3
    New Member
    • Apr 2010
    • 1

    How to fix ambiguous column error?

    This is what I am trying to accomplish:
    To determine what type of work is most bountiful for my company, i am trying to create a query and report titled “Hours Against Each WorkCode” that includes a summary of Hours worked against each WorkCode. Display WorkCodeID, WorkCodeDescr, and HoursWorked (using HOURS and WORKCODES tables)

    This is what i have and i am getting a ambiguous column error for workcodeID which is in both tables. I feel like i have to join them somehow. HELP!

    This is what i have
    USE tisds5Project
    SELECT WorkCodeID, WorkCodeDescr, HoursWorked
    FROM tblHOURS, tblWORKCODES
    ORDER BY HoursWorked, WorkCodeID
  • akdemirc
    New Member
    • Sep 2008
    • 26

    #2
    when dealing with columns with the same name from different tables you should uniquely define each such column by preceding the table name before its name.. so in your query you should declare which you mean by WorkCodeID.. Is it tblHOURS.WorkCo deID or tblWORKCODES.Wo rkCodeID ?

    Comment

    • nbiswas
      New Member
      • May 2009
      • 149

      #3
      Use table alias.

      Comment

      Working...