Reputation: 271
This is my table Data
Id Begin End
1 0 1
2 1 3
3 3 4
This is my Query:
DECLARE @abc Float=1.5;
SELECT * FROM dbo.Slab AS s WHERE @abc BETWEEN s.Begin AND s.End
This give me 2 rows. I want to find a row for which @abc parameter is greater than Begin but less or equal to End.For example if @abc=1 i want to select 1 , if @abc=1.5 I want to select 2 , if @abc=3 i want to select 2 , if @abc=0.1 i want to select 1 and so on.
Upvotes: 3
Views: 53
Reputation: 84
DECLARE @abc Float=1.5;
SELECT * FROM dbo.slab AS s WHERE @abc > s.[begin] and @abc<=s.[end]
Upvotes: 1