Quantcast
Viewing latest article 7
Browse Latest Browse All 11

Android: SQLite select data using SQL statement returning cursor

Use the .rawQuery function to use a SQL statement to retrieve data into cursor.


	    public Cursor fetchAllDineoutHistoryFormatDate(){
 
	    	String sSelect = "SELECT " + K_ROWID + ", " + K_TITLE + ", " + K_DATE + ", " +
	    					"strftime('%" +
	    					"H:%M:%S'," + K_TIME + ", 'localtime') as "
	    	                  + K_TIME + ", " + K_MEAL + ", " + K_TOTAL + " FROM " + DATABASE_TABLE + " ORDER BY "
	    	                  + K_DATE + " desc, " + K_TIME + " desc";
	    	return mDb.rawQuery(sSelect, null);
	    }
 

Viewing latest article 7
Browse Latest Browse All 11

Trending Articles