我想检查表中存在的值 [英] I want to check value existing in table
本文介绍了我想检查表中存在的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的,我有一张这样的桌子。
ID OSRange OSRangeUpTo TrackedBy
6 0.00 50000.00 HOL
7 50001.00 75000.00 ARM
8 75001.00 100000.00 RM
9 100001.00 125000.00 DGM
10 125001.00 150000.00 GM
11 150001.00 200000.00 AVP
12 200001.00 250000.00 VP
13 250001.00 999999999.00总统
我想检查表中是否存在60000到70000这样的范围。
解决方案
- 用于OSRANGE检查
如果存在(从TABLE_NAME中选择*
,其中OSRANGE在60000和100001之间)
//您的代码继续
- 对于OSRANGEUPTOcheck
如果存在(从TABLE_NAME中选择*
,其中OSRANGEUPTO在60000和100001之间)
//你的代码继续
- 组合OSRANGE和OSRANGEUPTOcheck
如果存在(选择*来自your_TABLE_NAME
其中OSRANGE > = 60000和OSRANGEUPTO< = 70000))
//你的代码继续
让我知道是否有效
Dear all, i have a table like this.
ID OSRange OSRangeUpTo TrackedBy
6 0.00 50000.00 HOL
7 50001.00 75000.00 ARM
8 75001.00 100000.00 RM
9 100001.00 125000.00 DGM
10 125001.00 150000.00 GM
11 150001.00 200000.00 AVP
12 200001.00 250000.00 VP
13 250001.00 999999999.00 PRESIDENT
I want to check that range like 60000 to 70000 exist in table or not.
解决方案
-- for OSRANGE check
If exists (select * from TABLE_NAME
where OSRANGE between 60000 and 100001)
//your code continues
--for OSRANGEUPTOcheck
If Exists(select * from TABLE_NAME
where OSRANGEUPTO between 60000 and 100001)
//your code continues
--for combined OSRANGE and OSRANGEUPTOcheck
if exists(select * from your_TABLE_NAME
where OSRANGE >=60000 and OSRANGEUPTO <=70000))
//your code continues
Let me know if that worked
这篇关于我想检查表中存在的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文