I'm doing a DB that shows the smallest value among three options, each option represents a column. I want to get the lowest value of a row where it contains these three values.
I'm doing a DB that shows the smallest value among three options, each option represents a column. I want to get the lowest value of a row where it contains these three values.
Use LEAST()
:
SELECT LEAST(1,2,3);
Result:
1
It will return the smallest value between the values entered in the function .
In your case, do:
SELECT LEAST(ColunaA, ColunaB, ColunaC) FROM Tabela
This way you will get the smallest value between the three tables of each line.