Activity Code
String MMS = \"(SELECT Name FROM UserData WHERE MessagesSent=(SELECT max(MessagesSent) FROM UserData))\";
db.execSQL(\"UPDATE MainData SET MostMess
If db is properly initialized, with this line:
db.execSQL("UPDATE MainData SET MostMessagesSent = "+ MMS + "+ WHERE Data = MyData");
you want to execute an UPDATE statement that will update the column MostMessagesSent of table MainData with a value fetched from the query strored in the variable MMS:
String MMS = "(SELECT Name FROM UserData WHERE MessagesSent=(SELECT max(MessagesSent) FROM UserData))";
In order for this to work you must have initialized properly the db object.
I suppose you have a class extending SQLiteOpenHelper which provides the initialization of db.
Also the names of the tables and columns must match the intended behavior.
The problem is that execSQL() does not return a value indicating that the update was successful or not.
You have to check it yourself.