dimanche 7 février 2016

android.database.sqlite.SQLiteException: syntax error

hey in my application i need to join two tables and i used this code :

Cursor shapes_cur = sq.getWritableDatabase().rawQuery("SELECT name from shapes INNER JOIN shapes ON shape_to_drug.id_shape=shapes.id WHERE shape_to_drug.id_drug =" + drug_id + " WHERE shape_to_drug.id_hp =" + hp_id, null);

but application force closed and i get this error in logcat:

android.database.sqlite.SQLiteException: near "WHERE": syntax error (code 1): , while compiling: SELECT name from shapes INNER JOIN shapes ON shape_to_drug.id_shape=shapes.id WHERE shape_to_drug.id_drug =360 WHERE shape_to_drug.id_hp =5

Aucun commentaire:

Enregistrer un commentaire