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)
 Query between two fields

Author  Topic 

neostar
Starting Member

18 Posts

Posted - 2006-01-05 : 09:41:07
I have a table which includes the following fields, and basically need to write a query that can pinpoint a serial no between the field range startserialno and endserialNo

Work Order (PrimaryKey)
StartSerialNo
EndSerialNo

So if I have the following data in my table for example

work order | StartSerialNo | EndSerialNo
1111 ----------- 1 ------------- 4
2222 ----------- 5 ------------- 9
3333 ----------- 10 ----------- 14

If someone gives me the serial no 6, how do I write a query to find out the work order for that serial no?

thanks

Dan

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-01-05 : 09:47:40
quote:
Originally posted by neostar
...write a query that can pinpoint a serial no between the field range startserialno and endserialNo...


where @SerialNo between StartSerialNo and EndSerialNo





CODO ERGO SUM
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2006-01-05 : 09:49:23
Where [SerialNo] between [StartSerialNo] and [EndSerialNo]
Go to Top of Page

neostar
Starting Member

18 Posts

Posted - 2006-01-05 : 09:58:09
Had a feeling it would be something simple.

Thanks for the help, saved me loads of time

Dan
Go to Top of Page
   

- Advertisement -