title: App Development using eclipse
body: <p>I want to retrieve minimum balance from table using where condition on button click.Following is my code it's not working plz give me solution.Thanks in advance..</p>
  
  <pre><code>smname = spn_mname.getSelectedItem().toString().trim();
  
  yname = spn_yname.getSelectedItem().toString().trim();
  
  scno = spn_count.getSelectedItem().toString().trim();
  
  String dbsyname = null, dbsmname = null, dbsycolor = null, dbscount = null, dbsrqty = null, dbsdqty = null, dbsbaln = null;
  DataBaseHelper dbh = new DataBaseHelper(StockActivity.this);
  
  SQLiteDatabase db = dbh.getReadableDatabase();
  
  Cursor cursor = db.rawQuery("SELECT MIN(Balance) FROM stocktable",null);
  if (cursor.moveToFirst()) {
      do {
          dbsmname = cursor.getString(cursor.getColumnIndex("Millname"));
          dbsyname = cursor.getString(cursor.getColumnIndex("Yarnname"));
          dbscount = cursor.getString(cursor.getColumnIndex("Counttno"));
  
          if (dbsmname.equals(smname) 
                  &amp;&amp; bsyname.equals(syname)
                  &amp;&amp; dbscount.equals(scno)) {
              dbsbaln = cursor.getString(cursor.getColumnIndex("Balance"));
          }
  
      } while (cursor.moveToNext());
  
      edtrqty.setText(dbsbaln);
  }
  </code></pre>