以指定的间隔查找数据

时间:2013-12-05 13:22:53

标签: c# sql

数据库记录像这样:

===============================

Table
-------------------------------
ID,OtherID, MinNumber,MaxNumber
-------------------------------
1  A       10        100
2  A       101       500
3  A       501       800
-------------------------------
4  B       10        200
5  B       201       550
more ....

-------------------------------

过滤器(OtherID=ANumber=45

如何确定表中是否已存在记录(过滤器)。

示例

SQL:

SELECT * FROM Table WHERE OtherID='A' AND  // code here

---或---

C#DataTable:

DataTable dt= new DataTable(); (dt's structer and records like Table);
// code here 

谢谢!

1 个答案:

答案 0 :(得分:0)

我想你想要这个

Declare @int INT
Set @int = 45
SELECT * FROM Table WHERE OtherID='A' AND (@int Between MinNumber And MaxNumber)
相关问题