title: Using SimpleCursorAdapter how can you query specific data from database
body: <p>I have a database from which I want to query and display only that data which has one type of similar field..
  Say all rows have a day(Mon to sun) in them... I want to display all the rows that have Monday as the day...
  I have used SimpleCursorAdapter to display all the rows from my database...
  Basically, I want to know how i can query in SimpleCursorAdapter to display rows of the data having only say, Monday as the day...</p>
  
  <p>Any help is appreciated...:)</p>
  
  <p>The following code enables me to display all the data from my data base...</p>
  
  <pre><code>    protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.testlayout2);
       listContent = (ListView)findViewById(android.R.id.list);//.id..list);
      mDB = new DataSource(this);
      mDB.open();
  
      cursor = mDB.queueAll();
      String[] from = new String[]{
              MySQLiteHelper.KEY_START, MySQLiteHelper.KEY_END,
              MySQLiteHelper.KEY_SUBJECT, MySQLiteHelper.KEY_LOC,
              MySQLiteHelper.KEY_TEACHER };
      int[] to = new int[] {R.id.tvStart, R.id.tvEnd,
              R.id.tvSub, R.id.tvLoc, R.id.tvTeacher };
  
  
              cursorAdapter = new SimpleCursorAdapter(this, R.layout.row, cursor,
              from, to);
  
          listContent.setAdapter(cursorAdapter);
          listContent.setOnItemClickListener(listContentOnItemClickListener);
      }
  
  }
  </code></pre>
  
  <p>I want the query to be like this..</p>
  
  <pre><code>  Cursor cursor = db.query(table, null, "day like " + "'%Monday%'",null, 
                                   null, null, null);
  </code></pre>
  
  <p>Got that... Sorry for the trouble. Please tell me where i am going wrong with this though..
  I made this in the code to query the day and sort ascending by time..</p>
  
  <pre><code> public Cursor queryDay(String days) {
      Cursor cursor = mDatabase.query(DATABASE_TABLE, mAllColumns, "day like " + 
                       days, null, null, null, Database.KEY_START + " ASC");
      if (cursor.moveToNext()) {
          return cursor;
      }
      return cursor;
  }
  </code></pre>
  
  <p>However, I get this error,</p>
  
  <pre><code>   android.database.sqlite.SQLiteException: no such column: Thursday: , 
     while compiling: SELECT _id, day,start_time, end_time, sub, location, 
     teacher FROM subjectTable WHERE day like Thursday ORDER BY start_time ASC
  </code></pre>
  
  <p>I am calling this like this..</p>
  
  <pre><code> Cursor cursor = mDB.queryDay("Thursday");
   startManagingCursor(cursor);
  </code></pre>