aamirault
SSC Rookie
Points: 36
More actions
January 11, 2008 at 11:58 am
#182673
I need to evaluate 2 fields in the same table and update a third field in the same table with the lesser value of the compared fields
Ie, check field A against field B, which ever is less (integer) update field C with the lesser value.
Thanks all.
Tony Mungor
SSC Eights!
Points: 850
January 11, 2008 at 12:05 pm
#767271
I'd use a CASE statement like the following.
update table1
set column3 = CASE WHEN column1 < column2 THEN column1 ELSE column2 END
January 11, 2008 at 12:50 pm
#767285
Thanks Tony!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply