Is it possible to take the min of four minumum column results? Here is the scenario: I have four columns in a table which contain numbers. I want the minimum of the 4 number combination for each result, and also the maximum of the same. I try this in my select min(number1),min(number2),min(number3),min(number4) from table where .... and I get the minimum number in each column for the given where condition. The issue is, of those four numbers, I want the min (smallest) of the four results returned. I tried this "select min(min(number1),min(number2),min(number3),min(number4)) from table where .... " an got an invalid number of arguments. I was hoping it would be as simple as such (just adding a min outside) but it does not work. Is there a better way? I do not want the min in each column, but the min in each column where a condition is met.
select min( least ( col1, col2, col3, col4)) from you_table [ where ...]
Thanks a bunch! Knew there had to be a way.