【发布时间】:2013-02-16 03:22:40
【问题描述】:
我无法让这条 sql 语句正常工作。有人可以帮助我吗?
public Cursor getContactMatches(String query, String[] columns)
{
String selection = COL_NAME + " LIKE " + "'%" + "%'"; <---- right here
Log.d("selection", selection);
String[] selectionArgs = new String[] {query+"*"};
return query(selection, selectionArgs, columns);
}
【问题讨论】:
-
select * from your_table where some_column like ( '%foobar%' )我认为您缺少(、)和foobar。做select * from your_table where some_column LIKE '%%'没有任何意义。 -
所以 foobar 不是一些随机的东西吗?你真的把它放在声明中了吗?
-
不,您没有指定要比较的值是什么