update via sql or spl?
update via sql or spl?
(OP)
Hello all-
I'm trying to perform an update. I've been reading through the manual on SPLs and cant piece it together. I have two tables (t1 & t2) with columns as follows:
t1
**
cust_id
date
t2
**
cust_id
fld02
I'd like to set t2.fld02 to 'Y' if t1.date is not null
I'd like to set t2.fld02 to 'N' if t1.date is null
I'm not sure how to loop through every customer in the t2 table and perform an if-then statement to set fld02 to a Y or N.
thanks for any suggestions,
Chris
I'm trying to perform an update. I've been reading through the manual on SPLs and cant piece it together. I have two tables (t1 & t2) with columns as follows:
t1
**
cust_id
date
t2
**
cust_id
fld02
I'd like to set t2.fld02 to 'Y' if t1.date is not null
I'd like to set t2.fld02 to 'N' if t1.date is null
I'm not sure how to loop through every customer in the t2 table and perform an if-then statement to set fld02 to a Y or N.
thanks for any suggestions,
Chris
RE: update via sql or spl?
CODE
UPDATE t2 SET fld02='N' WHERE cust_id IN(SELECT cust_id FROM t1 WHERE date IS NULL);
Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?