Beginner
Beginner

Reputation: 29573

android how to do a select and where join statement

    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);

How do i make this statement work?

Upvotes: 1

Views: 1733

Answers (1)

WarrenFaith
WarrenFaith

Reputation: 57702

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

Only once you need to use "where"

Upvotes: 1

Related Questions