问题描述:

Database records Like This:

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

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 ....

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

Filters (OtherID=A,Number=45 )

How to determine whether the record(Filters) already exists in the table .

Example

SQL:

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

--- OR ---

C# DataTable:

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

// code here

Thanks !

网友答案:

I think you want this

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