vendredi 2 octobre 2015

android join two tables by date

Hello I am new to android programing and I have problem with SQLite db.

I manage to get some information from one of my tables,

 public Cursor returnData(){
    SQLiteDatabase db = helper.getWritableDatabase();

    String[] columns = {TableHelper.Column_1, TableHelper.Column_2, TableHelper.Column_3};
    Cursor cursor = db.query(TableHelper.TABLE_NAME, columns, null, null, null, null, null);

    return cursor;
}

but now I try to select from two tables and to return that values.

And I need to wrote method that will return from 2 tables and do join tables by date...

String MY_QUERY = "SELECT * FROM TABLE_1 a INNER JOIN TABLE_2 b ON a.date=b.date";
    db.rawQuery(MY_QUERY);

Where I make mistake here?

Aucun commentaire:

Enregistrer un commentaire