title: SQLite INNER JOIN throws a NullPointerException
body: <p>I can't understand why the query ends up throwing a <code>NullPointerException</code>.</p>
  
  <p>My database contains two tables. The first one called <code>TABLE_WORDS</code> contains words; the second one called <code>TABLE_TRANS</code> contains the translations. One word can have many translations.</p>
  
  <pre><code>public static final String CREATE_TABLE_WORDS = "CREATE TABLE " + TABLE_WORDS + 
      " (" + WORDS_ID + " INTEGER PRIMARY KEY, " + WORDS_WORD + 
      " TEXT);";
  
  public static final String CREATE_TABLE_TRANS = "CREATE TABLE " + TABLE_TRANS + 
      " (" + TRANS_ID + " INTEGER PRIMARY KEY, " + 
      TRANS_WORD + " TEXT, " + 
      TRANS_FOREIGN_ID_WORD + " INTEGER, " +
      "FOREIGN KEY (" + TRANS_FOREIGN_ID_WORD + ") REFERENCES " + TABLE_WORDS + "(" + WORDS_ID + "));";
  </code></pre>
  
  <p>I query translations by a word ID, and an <code>NPE</code> is thrown.</p>
  
  <pre><code>public Cursor queryTransesByWord(int idSend) {
  
      String query = "SELECT " + DbHelper.TABLE_WORDS + "." + DbHelper.WORDS_WORD + ", " +
          DbHelper.TABLE_TRANS + "." + DbHelper.TRANS_WORD + 
          " FROM " + DbHelper.TABLE_WORDS + 
          " INNER JOIN " + DbHelper.TABLE_TRANS + 
          " ON " + DbHelper.TABLE_WORDS + "." + DbHelper.WORDS_ID + "=" + 
          DbHelper.TABLE_TRANS + "." + DbHelper.TRANS_FOREIGN_ID_WORD + " WHERE " +
          DbHelper.TABLE_WORDS + "." + DbHelper.WORDS_ID + "="+ idSend; 
  
      Cursor cur = db.rawQuery(query, null); // NullPointer always throws here
  
      if (cur != null)
          cur.moveToFirst();
      else
          Log.e(Constants.LOG_TAG, Constants.DB_ADAPTER_CLASS_NAME_SEP + "queryTransesByWord cursor is null");
      return cur;
  }
  </code></pre>