Advertisement
Ankhwatcher

Return Highest Value From Column ROUTE_NUMBER

Feb 21st, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1.     public int highestRoute(SQLiteDatabase db)
  2.     {
  3.         int highRoute = 0;
  4.         try {
  5.            
  6.             Cursor results = db.rawQuery("SELECT MAX("+ROUTE_NUMBER+") FROM "+TABLE_NAME, null);
  7.             if (results.moveToFirst())
  8.             {
  9.                
  10.                     highRoute = results.getInt(1);
  11.                
  12.             }
  13.         } catch (Exception e)
  14.         {
  15.             Log.e(FixOpenHelper.class.getName(), "Unable to get highestRoute.", e);
  16.         }
  17.        
  18.             return highRoute;
  19.        
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement