Oracle SQL update statement with two table joins
Posted on 2014-08-13
I have three tables involved in this. I need to update one table (AUTO_EFORM) and column (EPLANT_ID) based on data in another table (ARCUSTO) and column (CUSTNO). The tables and columns are listed below for reference and needed joins.
The CUSTNO field is a string value and I want to evaluate the last three characters.
If right(custno,3) = -10 then AUTO_EFORM.EPLANT_ID = 10
If right(custno,3) = -20 then AUTO_EFORM.EPLANT_ID = 20
If right(custno,3) = -30 then AUTO_EFORM.EPLANT_ID = 30
If right(custno,3) = -40 then AUTO_EFORM.EPLANT_ID = 40
If right(custno,3) = -50 then AUTO_EFORM.EPLANT_ID = 50