title: Database retreival in android
body: <p>I am retrieving data from database using select query.My requirement is i have to sum the (total) column where <code>group=household</code> and <code>category=Income</code>.I have 1 entry in database which satisfy this condition.But it returns always 0.Please help me.</p>
  
  <p>My query is:</p>
  
  <pre><code>long sum=0;
      Cursor cursor1 = db.rawQuery(
               "SELECT SUM("+(KEY_TOTAL)+") FROM incomexpense WHERE groups='Household' &amp; category='Income'",null);
       if(cursor1.moveToFirst())
       {
         sum = cursor1.getLong(0);
       }
       cursor1.close();
       String housetotal=String.valueOf((long)sum);       
       System.out.println("house="+housetotal);
  </code></pre>