In MySQL, I would like to make a choice and get the sum, but the multiplication should depend on the value of one of the columns. So this is a regular statement:
SELECT col1 * col2 AS sum
But if col2 < 0 , col2 should take 0 as a value, so something like: SELECT col1*(col2 < 0 ? 0 : col2) AS sum
Can I do this in MySQL?
joh-3
source share