I need to multiply value of 2 column in which is in my sqlite table. I have done this. But I missed to pass a specific product id to do multiplication.I used following code to multiply to column.
public int getMultiply() {
Cursor cursor = db.rawQuery("SELECT " + DbHelper.CART_QUANTITY + " * " + DbHelper.CART_PRICE + " AS result FROM " + DbHelper.CART_TABLE, null);
if (cursor.moveToFirst()) {
Log.w("result", cursor.getDouble(0) + "");
return (int) cursor.getDouble(0);
}
return 0;
}
Now I need to correct my calculation by passing Product Id.How to multiply 2 column by passing parameter?
public int getMultiply(String PID) {..........return 0;}
Aucun commentaire:
Enregistrer un commentaire