小编Jac*_*ack的帖子

如何在SQL中使用'like'运算符?

我想从C_Table哪里选择Name='John'并使用like运算符.例如,

select Name from C_Table where Name='John' AND where Details like %Boy%
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?

(Table name is C_Table)
-----------------------------------------------
Name   |  P_No  |  C_No   |  Details          |
-----------------------------------------------
John   |  001   |  001    |  Good Boy         |
John   |  002   |  002    |  Naughty Boy      |
John   |  003   |  003    |  Very Bad Boy     |
Mary   |  004   |  004    |  Beautiful Girl   |
Mary   |  005   |  005    |  Pretty Girl      |
Mary …
Run Code Online (Sandbox Code Playgroud)

sql sql-like

2
推荐指数
1
解决办法
2万
查看次数

如何使用for循环android搜索sqlite数据库记录

我想循环遍历sqlite数据库if if(johnny)是否存在于数据库中,但我的代码不起作用

if(!cursor.isAfterLast()) 
{
    do 
    {
        for(int i = 0; i<cursor.getCount(); i++)
        {
            if("johnny" == cursor.getString(1))
            { 
                Toast.makeText(getApplicationContext(), "string found!!! =)", Toast.LENGTH_LONG).show();
            }
        }                   
    } 
    while (cursor.moveToNext());
    }       
    cursor.close();
}
Run Code Online (Sandbox Code Playgroud)

android android-sqlite

0
推荐指数
1
解决办法
761
查看次数

标签 统计

android ×1

android-sqlite ×1

sql ×1

sql-like ×1