I have a table that looks like this:
Quote Super Factor
29 63 [83.79]
38 61 [81.13]
79 65 [86.45]
47 40 [80]
81 25 [50]
82 35 [70]
I want to take the column ‘Super’ and multiply it by 1.33 IF the ‘Quote’ is 29, 38, 79. If the field ‘Quote’ is 47, 81, 82 then multiply ‘Super’ by 2.
Quote is “BigInt(10)” and both ‘Super’ and ‘Factor’ have a type of “Double”. The name of the table is “Quote_IDX”.
Note: The numbers in ‘[]’ are what I should end up with once this calculation is done. As you can probably tell I’m fairly new to MySQL so I need some help.
Thanks in advance.
You can use the following which uses a
CASEstatement. TheSELECTwill show you the data results:See SQL Fiddle with demo. Then if you want to do an
UPDATEof thefactorcolumn:See SQL Fiddle with Demo