问题描述
我正在尝试使用查询将表缩小到仅字段[全名]包含字段[名]中的值的行.
例如,如果某行在[全名]中有"Blake Johnson",在[名]中有"John",则将包括该行.但是,如果[全名]带有"Garry Sways",而[名]带有"Swan"-则不会包含此行.
我尝试使用:
Like "*[first name]*"
在[全名]的条件中.
但是效果不是很好.
这种情况下是否存在包含"功能?
谢谢.
只需执行此操作
SELECT * From yourTable WHERE instr(fullname, firstname) > 0
I'm trying to use a query to narrow the table down to only the rows in which the field [full name] contains the value in the field [first name].
For instance, if a row has "Blake Johnson" in [full name] and "John" in [first name] - this row will be included.But if [full name] has "Garry Sways" and [first name] has "Swan" - this row will NOT be included.
I tried to use:
Like "*[first name]*"
In the criteria for [full name].
But it didn't work quite well.
Is there a "Contains" funciton for this case?
Thanks in advance.
Just do this
SELECT * From yourTable WHERE instr(fullname, firstname) > 0
这篇关于访问查询-一个字段是否包含另一个字段的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!