jeudi 27 août 2015

I Can't find the syntax error [duplicate]

This question already has an answer here:

I have this code:

ContentValues newValues = new ContentValues();
SQLiteDatabase db = openOrCreateDB(context);

DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
String endtime = dateFormat.format(cal.getTime());

final String MY_QUERY = "UPDATE UserPaths " +
            "SET endtime=? " +
            "FROM UserInfo " +
            "INNER JOIN UserPaths ON UserPaths.pathuser=UserInfo.userid " +
            "WHERE UserInfo.name=? AND UserInfo.surname=?";

String[] args = new String[]{
            endtime,
            name,
            surname
    };

Cursor c = db.rawQuery(MY_QUERY, args);

and I get:

android.database.sqlite.SQLiteException: near "FROM": syntax error (code 1): , while compiling: UPDATE UserPaths SET endtime=? FROM UserInfo INNER JOIN UserPaths ON UserPaths.pathuser=UserInfo.userid WHERE UserInfo.name=? AND UserInfo.surname=?

I can't fin the syntax error.Can anyone help?

Aucun commentaire:

Enregistrer un commentaire