Comparing a value in between two columns

I have a table TblControl. Data type of both field is int.

StartRange End Range

BMIClassification Table

startval endvalue

0 100
200 300
500 600
900 950

SELECT StartRange, EndRange
FROM Control
WHERE 225 BETWEEN StartRange AND EndRange

eg:-
Declare @BMIValue int

set @BMIValue=34

SELECT * FROM BMIClassification
WHERE @BMIValue between
startval and endvalue

 

 

Comments

Popular posts from this blog