Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

help required for a update scenario - response (2) by sujiwarrier

$
0
0

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

 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>