0
I have a table with four columns, the first with one type, the second with the minimum value , the third with the max value, and the fourth with the data I want. I need to select the value of the fourth column when the type is in the table and the value entered is between the maximum and minimum value, I tried to do as follows:
SELECT VALOR FROM TABELA WHERE TIPO = 1 AND MINIMO <=0.3 AND MAXIMO >= 0.3;
TIPO MINIMO MAXIMO VALOR
1 0 0,15 0
1 0,2 0,29 8,1
1 0,3 0,54 7,97
1 0,55 5 7,42
For the table above, the value should be 7.97, but not the right one. If I try to exchange 0.3 for 0.31, I get the desired result.
I simulated your data and there was no problem... Sqlfiddle
– KaduAmaral