title: How to implement Android Sqlite Union rawQuery?
body: <p>I am using the following code to search the column "English". There is another column called "BANGLA". How I should modify the code so that both "ENGLISH" and "BANGLA" columns are searched simultaneously and returned as combined result? </p>
  
  <pre><code>public List&lt;Bean&gt; getWords(String englishWord) {
          if(englishWord.equals(""))
              return new ArrayList&lt;Bean&gt;();
  
          String sql = "SELECT * FROM " + TABLE_NAME +
                  " WHERE " + ENGLISH + " LIKE ? ORDER BY " + ENGLISH + " LIMIT 100 ";
  
          SQLiteDatabase db = initializer.getReadableDatabase();
  
          Cursor cursor = null;
          try {
              cursor = db.rawQuery(sql, new String[]{"%" + englishWord + "%"});
  
              List&lt;Bean&gt; wordList = new ArrayList&lt;Bean&gt;();
              while(cursor.moveToNext()) {
                  int id = cursor.getInt(0);
                  String english = cursor.getString(1);
                  String bangla = cursor.getString(2);
                  String status = cursor.getString(3);
                  wordList.add(new Bean(id, english, bangla, status));
              }
  
              return wordList;
          } catch (SQLiteException exception) {
              exception.printStackTrace();
              return null;
          } finally {
              if (cursor != null)
                  cursor.close();
          }
      }
  </code></pre>
  
  <p>I modifed the <code>String sql</code> to</p>
  
  <pre><code>String sql = "SELECT * FROM " + TABLE_NAME +
                  " WHERE " + ENGLISH + " LIKE ? ORDER BY " + ENGLISH + " LIMIT 100 " + " UNION ALL " + " SELECT * FROM " + TABLE_NAME +
                  " WHERE " + BANGLA + " LIKE ? ORDER BY " + ENGLISH + " LIMIT 100";
  </code></pre>
  
  <p>However, this does not work. I am getting this error:</p>
  
  <pre><code>ORDER BY clause should come after UNION ALL not before (code 1): , while compiling: SELECT * FROM words WHERE en_word LIKE ? ORDER BY en_word LIMIT 100  UNION ALL  SELECT * FROM words WHERE bn_word LIKE ? ORDER BY en_word LIMIT 100
  </code></pre>