Friday, March 23, 2012

Query value in between two columns

Hi All,

I am new to Sql and I want to know if a given value lets say its 225
is within ranges defined in the table.

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

StartRange End Range
0 100
200 300
500 600
900 950

(Sql server 2000 on window 2000)

Thanks
-MaxOn 26 Aug 2004 12:13:48 -0700, Max wrote:

>Hi All,
>I am new to Sql and I want to know if a given value lets say its 225
>is within ranges defined in the table.
>I have a table TblControl. Data type of both field is int.
>StartRange End Range
>0 100
>200 300
>500 600
>900 950
>(Sql server 2000 on window 2000)
>Thanks
>-Max

Hi Max,

You can test this with BETWEEN. Example:

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

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)|||Thanks Hugo,

It solved my problem.

-Maxsql

No comments:

Post a Comment