mercredi 4 novembre 2015

android.database.sqlite.SQLiteException: near "..."

I am trying to update one column of second table based on column of first table. I want to update column lid in record table with values of cid column of detail table based on rid (detail table) and crid (record table).

public String updateId() {

        String selectQuery = "UPDATE record SET lid = (SELECT detail.cid FROM detail WHERE detail.rid = record.crid" ;

        SQLiteDatabase db = this.getWritableDatabase();
        Cursor cursor = db.rawQuery(selectQuery, null);

        return null;

    }

Log says:

  android.database.sqlite.SQLiteException: near "crid"

Activity - on button click, using below code to update table:

 dh.updateId();

Aucun commentaire:

Enregistrer un commentaire