Insert with Inner Join and various conditions in Where clause

Asked

Viewed 152 times

1

What is the best way to make one SELECT with INNER JOIN and with various conditions using Sqlite Android?

I thought I’d do it this way:

SQLiteQueryBuilder _QB = new SQLiteQueryBuilder();

_QB.setTables("TABELA_1 INNER JOIN TABELA_2
               ON TABELA_1.ID =TABELA_2.TABELA_1_ID");

String[] columns = new String[]
{
   " SUM (column1) as column1",
   " SUM (column2) as column2"
};

String groupBy = "column1";

String selection = "column1=example1 AND column2=example2";

String orderBy = " column2 ASC ";

SQLiteDatabase db = beginTransactiongin();

Cursor cursor = _QB.query(SQLiteDatabase, columns, selection, null,groupBy, null,orderBy);
  • 2

    Try to be more descriptive in your problem, especially in the title. This helps you get a better result and more easily. See also: http://meta.pt.stackoverflow.com/questions/297/quando-se-deve-coloca-o-nome-da-linguagem-no-t%C3%Adtulo

  • 1

    I’ve already made the change I think now this noticeable

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.