DEV Community

Sebastiangperez
Sebastiangperez

Posted on

SQL Query Help

Im in one of those moments of lapsus where you think that im a fraud...
I have a table with this columns:
name , max , min
test, 100 , 40
test2, 39 , 20
and i have a result of 35 , and i need to know if is test or test 2 but the value must be between those max and min.
Does anyone knows a query to do that?

thanks.

Top comments (3)

Collapse
 
katnel20 profile image
Katie Nelson
SELECT name
FROM tableName
WHERE (max >= 35 && min <= 35)

Although the '35' should be declared as a variable.

Collapse
 
sebastiangperez profile image
Sebastiangperez

Works... lapsus
Thanks Katie !!!

Collapse
 
katnel20 profile image
Katie Nelson

Glad I could help Sebastian. Good luck with SQL.