Skip to content
Advertisement

Sql check range exist between a range

i have a table like

and i have a range value for example

i want to get row who’s value matchs the range from database table

Example minV = 5 , maxV = 15 should return first and second record

Example minV = 5 , maxV = 35 should return all record

Example minV = 5 , maxV = 9 should return first record

Advertisement

Answer

I think you want:

This is the logic for overlapping intervals — basically, each “min” is less than the other’s “max”.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement