Stacie
asked on
Updating a field based from a if exist....
Lets say I have this query below and it return some value I would like to change the value of t.fieldC = 10 instead of t.field = 0
if exist( not sure what to do here
select t.fieldA from yourtable t
where t.fieldB = 'export'
and t.fieldC = 0
and exists( select null from yourtable o
where o.fieldA = t.fieldA
and o.fieldB = 'export b'
and o.fieldC = 10
)
if exist( not sure what to do here
select t.fieldA from yourtable t
where t.fieldB = 'export'
and t.fieldC = 0
and exists( select null from yourtable o
where o.fieldA = t.fieldA
and o.fieldB = 'export b'
and o.fieldC = 10
)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BEGIN
-- your update statement goes here
END
ELSE
BEGIN
--- your else condition or whatever you want to return.
END
hope this helps.