malycom
05-14-2008, 08:51 AM
Hi
Sorry if this is going to be long winded but there is no other way I can think of explaining it.
I need to update a table called T_FIXFEE with certain information.
The problem is, this table needs to take certain details from the CLIENTS table and another table called T_ACTIV which is the actual table that holds the value I need to insert.
Here are the tables and the fields from those tables that need to be used. There are many more fields but I think these are the only ones that have any baring.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CLIENTS
CL_KEY = PK
CL_CATEGORY (I need to only use category CO for the insert)
Other fields but not needed in this example
T_FIXFEE
TFF_CLIENT = PK1 : Links to CL_KEY
TFF_ACTIVITY = PK2 : Links to TA_KEY
Other fields not required
T_ACTIV
TA_KEY = PK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Basically I need to insert into the table T_FIXFEE a value of DFF which resides in table T_ACTIV, field TA_KEY. I also have to ensure that this only affects clients in this table where clients are Companies, meaning we have to bring CLIENT.CL_CATEGORY value = 'CO' into the equation.
If there is a client in CLIENT.CL_KEY but not in T_FIXFEE.TFF_CLIENT, I also need to make sure that T_FIXFEE insert the client key into T_FIXFEE.TFF_CLIENT
If there is a client in T_FIXFEE that already has the value 'DFF' in TFF_ACTIVITY, I don't need it to add 'DFF'again.
I hope I am explaining myself enough as I am not really sure what needs to be done.
Thanks in advance
Sorry if this is going to be long winded but there is no other way I can think of explaining it.
I need to update a table called T_FIXFEE with certain information.
The problem is, this table needs to take certain details from the CLIENTS table and another table called T_ACTIV which is the actual table that holds the value I need to insert.
Here are the tables and the fields from those tables that need to be used. There are many more fields but I think these are the only ones that have any baring.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CLIENTS
CL_KEY = PK
CL_CATEGORY (I need to only use category CO for the insert)
Other fields but not needed in this example
T_FIXFEE
TFF_CLIENT = PK1 : Links to CL_KEY
TFF_ACTIVITY = PK2 : Links to TA_KEY
Other fields not required
T_ACTIV
TA_KEY = PK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Basically I need to insert into the table T_FIXFEE a value of DFF which resides in table T_ACTIV, field TA_KEY. I also have to ensure that this only affects clients in this table where clients are Companies, meaning we have to bring CLIENT.CL_CATEGORY value = 'CO' into the equation.
If there is a client in CLIENT.CL_KEY but not in T_FIXFEE.TFF_CLIENT, I also need to make sure that T_FIXFEE insert the client key into T_FIXFEE.TFF_CLIENT
If there is a client in T_FIXFEE that already has the value 'DFF' in TFF_ACTIVITY, I don't need it to add 'DFF'again.
I hope I am explaining myself enough as I am not really sure what needs to be done.
Thanks in advance