Q:

MYSQL INSERT based on values from 3 columns

I have a mysql database and I would like to do an SELECT/INSERT based on the conditions of three different numeric fields: (HI, OT and WC). 
I want to INSERT into a field called AT the value of the following condition:
HI if HI > OT
else
WC if WC < OT
else 
OT

Something like this, but I cannot seem to get it correct:
INSERT INTO variations (AT)
SELECT

HI if HI > OT
else
WC if WC < OT
else
OT,
FROM archive;

A:

Try this : 
mysql> INSERT INTO variations (AT)
     ->SELECT CASE WHEN HI > OT THEN HI
     ->WHEN WC < OT THEN WC ELSE OT END FROM archive;

