android如何做一个select和where join语句

时间:2011-02-22 12:30:14

标签: android sql sqlite

    SQLiteDatabase db = dbs.getReadableDatabase();
       String SQL = "SELECT * FROM one a " +
                "join two b on a.oneID = b.twoID " +
                "where a.oneId = '"+Id+"' And where " +
                "b.column2 = 'Inc'"; 
        Cursor cursor2 = db.rawQuery(SQL, null); 
        startManagingCursor(cursor2);

如何使此声明有效?

1 个答案:

答案 0 :(得分:2)

"SELECT * FROM one a " +
    "join two b on a.oneID = b.twoID " +
    "where a.oneId = '"+Id+"' And " +
    "b.column2 = 'Inc'";

只有在您需要使用“where”