【发布时间】:2013-05-21 15:40:52
【问题描述】:
如何为 msaccess 数据库编写包含查询
我的表有列值'CHOPE PARMA TERA 101'
我在 PARMA 中的搜索关键字。
如何编写包含查询来检索记录?
【问题讨论】:
如何为 msaccess 数据库编写包含查询
我的表有列值'CHOPE PARMA TERA 101'
我在 PARMA 中的搜索关键字。
如何编写包含查询来检索记录?
【问题讨论】:
在 MS Access 中查询:
select * from SomeTable Where SomeColumn Like '* PARMA *'
对于标准 SQL,就像'% PARMA %'
请注意,上述语句不会找到 'PARMA'、'CHOPE PARMA' 或 CHOPE PARMAHAM 101',或者
任何包含 PARMA 的值;为此,只需删除搜索字符串中的空格,例如'*PARMA*'
select * from SomeTable Where SomeColumn Like '*PARMA*'
【讨论】:
ALike 而不是Like?:SELECT * FROM groups WHERE Orgin Alike '%PARMA%'
您是在询问有关使用 Like 条件的问题吗?
如果是这样,还有更多信息here
MS Access:Access 2003/XP/2000/97 中的 LIKE 条件(使用通配符)
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
举例
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
【讨论】: