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

    Unanswered: Probs with update query

    The select statement works, but the update below does not. Did I do it wrong?


    SELECT j.emp, j.job, j.sow_code, j.emp_sow_price, s.pay_rate
    FROM job j
    JOIN employee e ON j.emp = e.emp_id
    JOIN sow_pay s ON j.sow_code = s.sow_code AND e.piece_payrate = s.pay_grade;


    UPDATE job
    SET emp_sow_price = s.pay_rate
    FROM job j
    JOIN employee e ON j.emp = e.emp_id
    JOIN sow_pay s ON j.sow_code = s.sow_code AND e.piece_payrate = s.pay_grade;

  2. #2
    Join Date
    Sep 2006
    Posts
    162
    Sorry, i always figure it out after I've posted.

    Below works.

    UPDATE job j, employee e, sow_pay s
    SET j.emp_sow_price = s.pay_rate
    WHERE j.emp = e.emp_id AND e.piece_payrate = s.pay_grade
    AND j.sow_code = s.sow_code AND j.emp_sow_price != s.pay_rate;

Posting Permissions

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