0

there are two tables with following columns and dataset:

      emp_details                  emp_value
emp_id--user_id--emp_name    emp_id--user_id--emp_name_val
123      111      CR          123     111        1
124      111      Gr          124     111        2

I want to update the value of emp_name_val=3 for emp_id=124 when emp_id=123 and emp_name_val=1.Need a procedure to update the values when there are such multiple conditions

POOJA
  • 1
  • 2
  • 1
    Possible duplicate of [How to do an update + join in PostgreSQL?](https://stackoverflow.com/questions/7869592/how-to-do-an-update-join-in-postgresql) – Scoots Mar 07 '19 at 17:11
  • It's not answered in the given question. – POOJA Mar 07 '19 at 18:47

1 Answers1

0
UPDATE emp_value
SET emp_name_val = 3
FROM emp_value inner join emp_details using(emp_id)
WHERE emp_id=123 and emp_name_val =1
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
  • Please add some explanation to your code so others can learn from what you've done. [From Review](https://stackoverflow.com/review/low-quality-posts/22419774). – Wai Ha Lee Mar 10 '19 at 00:04