I created a temp table to maintain the customer group information with a flag:
temp_table
cust_id flag
C1 Y
C2 N
C3 N
The below update query will work if customer C1 is present in daily data, but need to modify the query in such a way that it should not do any update if C1 is not present in daily data. Here C1 is considered as primary customer , if its not there data should flow as such.
update tgt
from table_A tgt,
(sel
cust_id,
flag
from
temp_table
) temp
set cal_qty=
case (when Customer_id=temp.cust_id and temp.flag='N')
then qty end
where Customer_id=temp.cust_id
I created a temp table to maintain the customer group information with a flag:
temp_table
cust_id flag
C1 Y
C2 N
C3 N
The below update query will work if customer C1 is present in daily data, but need to modify the query in such a way that it should not do any update if C1 is not present in daily data. Here C1 is considered as primary customer , if its not there data should flow as such.
update tgt
from table_A tgt,
(sel
cust_id,
flag
from
temp_table
) temp
set cal_qty=
case (when Customer_id=temp.cust_id and temp.flag='N')
then qty end
where Customer_id=temp.cust_id