Hi everyone
I have a query that is boggling me !
I have three tables, e.g. S_CONTACT, EIM_CONTACT and S_EMPLOYEE.
==============
S_CONTACT
- Created_by
- Row_id
===============
EIM_CONTACT
- Created_by
- T_Contact__RID
===============
S_EMPLOYEE
- Row_id
- Login
===============
The relationships between these tables are:
S_CONTACT - EIM_CONTACT
Row_id - T_Contact__rid
EIM_CONTACT - S_EMPLOYEE
Created_by - Login
The Created_by in the EIM_CONTACT table is the LOGIN in the S_EMPLOYEE table. What I want to do is (update) make the Created_by in the S_CONTACT table equal the corresponding ROW_ID in the S_EMPLOYEE table.
The following SQL gives me an indication of what I need, but it is the SELECT, I need to make this an UPDATE !
I imported the tables into Access 2000, and using the query builder got the following:
Now I'm confused, I can't run this in DB2. Does it shed any light on the situation? Would anyone please please please be able to help me out of "another fine mess" (!!!!) I have gotten myself into!
Regards and peace !
OLAPer
I have a query that is boggling me !
I have three tables, e.g. S_CONTACT, EIM_CONTACT and S_EMPLOYEE.
==============
S_CONTACT
- Created_by
- Row_id
===============
EIM_CONTACT
- Created_by
- T_Contact__RID
===============
S_EMPLOYEE
- Row_id
- Login
===============
The relationships between these tables are:
S_CONTACT - EIM_CONTACT
Row_id - T_Contact__rid
EIM_CONTACT - S_EMPLOYEE
Created_by - Login
The Created_by in the EIM_CONTACT table is the LOGIN in the S_EMPLOYEE table. What I want to do is (update) make the Created_by in the S_CONTACT table equal the corresponding ROW_ID in the S_EMPLOYEE table.
The following SQL gives me an indication of what I need, but it is the SELECT, I need to make this an UPDATE !
Code:
select
A.row_id as S_Employee_ROW_ID,
A.login as S_Employee_LOGIN,
B.row_id as S_Contact_ROW_ID,
B.created_by as S_Contact_CREATED_BY,
c.created_by as EIM_Contact_Created_by
from
siebel.s_employee A,
siebel.s_contact B,
siebel.eim_contact C
where
B.row_id = C.T_contact__rid and
A.login = upper(C.created_by);
I imported the tables into Access 2000, and using the query builder got the following:
Code:
UPDATE SIEBEL_S_CONTACT INNER JOIN (SIEBEL_S_EMPLOYEE INNER JOIN SIEBEL_EIM_CONTACT ON SIEBEL_S_EMPLOYEE.LOGIN = SIEBEL_EIM_CONTACT.CREATED_BY) ON SIEBEL_S_CONTACT.ROW_ID = SIEBEL_EIM_CONTACT.T_CONTACT__RID SET SIEBEL_S_CONTACT.CREATED_BY = [SIEBEL_EIM_CONTACT].[created_by];
Regards and peace !
OLAPer