MS Access包含查询

Spe*_*n D 4 ms-access ms-access-2007

如何编写包含msaccess数据库的查询

我的桌子有列值'CHOPE PARMA TERA 101'

我在PARMA中的搜索关键字.

如何编写包含查询以检索记录?

Ton*_*son 12

在MS Access中查询:

select * from SomeTable Where SomeColumn Like '* PARMA *'
Run Code Online (Sandbox Code Playgroud)

对于标准SQL,它就像 '% PARMA %'

请注意,上述声明不会找到'PARMA','CHOPE PARMA'或CHOPE PARMAHAM 101',或包含PARMA的任何值; 这样做只需删除搜索字符串中的空格,例如'*PARMA*'

select * from SomeTable Where SomeColumn Like '*PARMA*'
Run Code Online (Sandbox Code Playgroud)


Bet*_*eth 9

你在询问使用Like条件吗?
如果是的话,还有更多的信息在这里

MS Access:LIKE条件(使用通配符)在Access 2003/XP/2000/97中

LIKE条件允许您在Access 2003/XP/2000/97中的SQL语句的where子句中使用通配符.这允许您执行模式匹配.LIKE条件可用于任何有效的SQL语句 - 选择,插入,更新或删除.

您可以选择的模式是:

* allows you to match any string of any length (including zero length)
? allows you to match on a single character
# allows you to match on a single numeric digit
Run Code Online (Sandbox Code Playgroud)

例如

Like 'b*'   would return all values that start with b
Like '*b*'  would return all values that contain b
Like '*b'   would return all values that end with b
Like 'b?'   would return all values that start with b and are 2 characters in length
Like 'b#'   would return all values that start with b and are 2 characters in length
where the second character is a number
Run Code Online (Sandbox Code Playgroud)