Errol Farro
asked on
Move Field values in same table
I have a table with 3 fields, field1, field2 and field3. I need to write an update query that moves field2 to field1 AND if field3 is entered, move field3 to field1 (replacing value just moved from field2). How can I accomplish this by using coldfusion?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Question: Is there a way to consider 0 as a not-null expression? It works fine when the value is Null but not when value is 0. Please advice.
ASKER
Sorry for the Typo:
Question: Is there a way to consider 0 also as a null expression? It works fine when the value is Null but not when value is 0. Please advice.
Question: Is there a way to consider 0 also as a null expression? It works fine when the value is Null but not when value is 0. Please advice.
update yourtable
set field1 = coalesce(nullif(field3,0), field2)
where ...
nullif ( a,b) returns null if a and b are equal... else a
set field1 = coalesce(nullif(field3,0),
where ...
nullif ( a,b) returns null if a and b are equal... else a
ASKER