title: Get all unique values from SQLite column as string array
body: <p>I try to get all unique values from database coulmn using SELECT DISTINCT sql command.
  But i get exception when my activity is loading, i have this error code in logcat:</p>
  
  <pre><code>05-05 09:08:32.637: E/AndroidRuntime(1314): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.workoutlog/com.example.workoutlog.AddWorkOutPage}: android.database.sqlite.SQLiteException: near "SELECT": syntax error (code 1): , while compiling: SELECT * FROM exerciseTable WHERE SELECT DISTINCTexercise_typefromexerciseTable
  </code></pre>
  
  <p>I think that i have not wrote the command correctly, here is my code:</p>
  
  <pre><code>public String[] getAllExercies() {
          String selecet = "SELECT DISTINCT" + COLUMN_EXERCISE + "from" + TABLE_NAME;
          Cursor c = ourDatabase.query(TABLE_NAME, null, selecet, null, null, null, null);
          int dayExercise = c.getColumnIndex(COLUMN_EXERCISE);
  
          String[] list = new String[c.getCount()-1];
          int j = 0;
          for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
              list[j] = c.getString(dayExercise);
              j++;
          }
  
          return list;
      }
  </code></pre>