OK... I have a select query that I am having trouble getting straight. Please help if you can figure this out:
Table1 has the following format:
approver|fnd|fnct|obj|org|unt|proj
USERID2 |XXX|XXXX|XXX|263|XXX|8024
USERID3 |XXX|XXXX|XXX|357|XXX|8024
USERID4 |110|XXXX|XXX|XXX|XXX|8053
Table2 has the following format:
req_id|fnd|fnct|obj|org|unt|proj
123456|110|5000|511|263|400|8024
234567|110|5000|511|330|400|8053
345678|110|5000|511|263|400|8074
Table3 has the following format:
req_id|approver
123456|USERID1
234567|USERID1
345678|USERID1
What I need to do is compare table1 and table2 to determine if values (fnd,fnct,obj,org,unt,proj combined) from table2 exist in table1. In table1, XXX's represent any value (wildcard). In other words, I don't care what the value is for that field. I only care about the fields that actually hold a number. On table2, the record that has "123456|110|5000|511|263|400|8024" matches table1's record that has "USERID2 |XXX|XXXX|XXX|263|XXX|8024". Then, if a record in table2 exists in table1, then I need to update table3 and set table3.approver = table1.approver where table3.req_id = table2.req_id.
So, using the above example, table3 would be updated as follows:
req_id 123456 approver would be updated to USERID2
req_id 234567 approver would be updated to USERID4
req_id 345678 approver would not be updated
Does this make sense. Any help would be great...
mwa
Table1 has the following format:
approver|fnd|fnct|obj|org|unt|proj
USERID2 |XXX|XXXX|XXX|263|XXX|8024
USERID3 |XXX|XXXX|XXX|357|XXX|8024
USERID4 |110|XXXX|XXX|XXX|XXX|8053
Table2 has the following format:
req_id|fnd|fnct|obj|org|unt|proj
123456|110|5000|511|263|400|8024
234567|110|5000|511|330|400|8053
345678|110|5000|511|263|400|8074
Table3 has the following format:
req_id|approver
123456|USERID1
234567|USERID1
345678|USERID1
What I need to do is compare table1 and table2 to determine if values (fnd,fnct,obj,org,unt,proj combined) from table2 exist in table1. In table1, XXX's represent any value (wildcard). In other words, I don't care what the value is for that field. I only care about the fields that actually hold a number. On table2, the record that has "123456|110|5000|511|263|400|8024" matches table1's record that has "USERID2 |XXX|XXXX|XXX|263|XXX|8024". Then, if a record in table2 exists in table1, then I need to update table3 and set table3.approver = table1.approver where table3.req_id = table2.req_id.
So, using the above example, table3 would be updated as follows:
req_id 123456 approver would be updated to USERID2
req_id 234567 approver would be updated to USERID4
req_id 345678 approver would not be updated
Does this make sense. Any help would be great...
mwa