I have a table in my data base that has three columns: Screen, Icon, and Rank: and i am trying to find the cleanest way to achieve the following..
i want to find all rows WHERE Screen = “myScreen” and Rank >5 // then make rank one less than current value.. I am doing this in Java via a SQLite Manager class in the following function:
public void DeleteScreenIcon (int id, String screenName, int rank){
int screenID = getScreenID(screenName);
SQLiteDatabase db=this.getWritableDatabase();
db.delete(isLookUp, colScreenID + "=" + screenID + " and " +colIconID+ "="+id, null);
// HERE IS WHERE I NOW WANT TO DO THAT..
db.execSQL("update "+ isLookUp +" set "+colRank+ "=" +colRank+ " -1 "+" where " + colScreenID + "='" +screenName + "' and " + colRank +">" +rank);
db.close();
}
sorry, im not that versed in SQL any help is appreciated
This update should do the trick: