DEV Community

Sebastiangperez
Sebastiangperez

Posted on

2 1

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.

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay