Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2006
    Posts
    162

    Unanswered: Attach a letter to a range.

    This is kinda weird, but should be doable. I'm setting up a grading system based on how well a an employee does.

    I have a table set up with the following fields.

    Type(will have 5-7 different values)
    Grade(A-F)
    Number(100, 90, 80, etc.
    Min(min value in range)
    Max(max value in range)

    Here are two example of a record in the table.
    Type, Grade, Number, Min, Max
    A1, A, 100, 5, 4.49
    A1, B, 90, 4.5, 4.99


    The reason I have a table specifying the range of the grade is because there are several different categories(types) the employee is graded on. The ranges for each category will vary in range.

    Hows the best way to have a query attach the Grade to the Employee, Type based on the percentage the range falls in?

    TIA

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    depends on a couple of things

    which employees? i can't see any employee data from here

    which range? how would you join the range data in the query?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Sep 2006
    Posts
    162
    Example of the Employee table with scores.

    Employee, Type, Score
    Emp1, A1, 4.62
    Emp2, A1, 4.95


    Now I want a query that will read
    Employee, Type, Score, Grade, Number
    Emp1, A1, 4.62, B, 90
    Emp2, A1, 4.95, A, 100

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you know how to do a join query?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Sep 2006
    Posts
    162
    I understand how to do queries and relationships, but I'm wanting to pull the Grade and Number based on the score. The score will land in a certain range of number, that will determine the Grade and Number from the table.

    It like when you get graded, you get A for 100 to 90, B for 89 to 80 and so on. I want to be able to adjust my number so I've set up a table to pull the Letter Grade passed on the score.

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yes, i understand

    so do a join
    Code:
      FROM Grades
    INNER
      JOIN Employees
        ON Employees.Grade BETWEEN Grades.Min AND Grades.Max
    simple, yes?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Sep 2006
    Posts
    162
    I see, thanks, i'll do that.

    Sorry been a long day.

Posting Permissions

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