过滤无法按预期工作 [英] Filtering is not working as expected
问题描述
我有一个表tbltest和3列(id,subject,status)。在sql中使用IN
关键字实现搜索,如下所示: -
I have a table tbltest and 3 column(id,subject,status).While implementing search using the "IN"
keyword in sql as follows:-
select * from tbltest where Rtrim(Ltrim(Subject)) in ('Call')
然后它什么也没显示,我在主题栏中有一个'Call'值
但是当我使用
then it shows nothing and i have a value 'Call' in column Subject
but when i use
select * from tbltest where Rtrim(Ltrim(Status)) in ('Completed')
然后它运行正常。
我曾尝试使用rtrim和ltrim删除前导和尾随空格但是没有成功。可能是什么问题。
then it works fine.
I had tried to remove the leading and trailing spaces using rtrim and ltrim but wasn't successfull.What could be the problem in it.
推荐答案
select * from tbltest where Rtrim(Ltrim(Subject)) in ('Call')
select * from tbltest where Rtrim(Ltrim(Status)) in ('Completed')
在第一个语句中,您使用了Subject列,但在第二个语句中,您使用了Status。
是故意的吗?
In the fist statement you have use Subject column but in second statement you have used Status.
Was it intentional?
select * from tbltest where Rtrim(Ltrim(Subject)) in ('Call')
在上面的查询中您使用的列主题
而在以下您使用的列状态
in the above query you are using the column Subject
whereas in the below you are using the column Status
select * from tbltest where Rtrim(Ltrim(Status)) in ('Completed')
请确保您的列名正确无误?
Please make sure your column names are correct ??
这篇关于过滤无法按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!