Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Get a record between 2 fields

Author  Topic 

nalin_769
Starting Member

16 Posts

Posted - 2008-02-27 : 00:51:28
I have a table call MAS_QTYRNG and fields are QTYCode, QtyRngFrom, QtyRngTo.
Ex: QTYCode QtyRngFrom QtyRngTo
1 2000 3000
2 3001 4000
3 4001 5000

How I specify sql query to get QTYCode vaue between QtyRngFrom and QtyRngTo. Given value will be 2500.

Thank You

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-27 : 02:03:28
SELECT * FROM MAS_QTYRNG
WHERE @MySearchValue BETWEEN QtyRngFrom AND QtyRngTo



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-27 : 02:12:32
or

SELECT * FROM MAS_QTYRNG
WHERE QtyRngFrom<=@MySearchValue AND QtyRngTo>=@MySearchValue

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

nalin_769
Starting Member

16 Posts

Posted - 2008-02-27 : 02:26:24
Peso thank you for the reply. It works.
Go to Top of Page
   

- Advertisement -