I want delivery charge compared to subtotal and calculate delivery charges. I got the result successfully. I get query and I put in that code execute in Execute SQL. I got correct answer. But
I have some problem in retrieve data. I got result everytime first position value only .
Below I have mention my code.Give me solution.
String Query ="select ROUND(delivarycharge) from pincodedetails where ROUND(subtotal)
<= ( select ROUND(subtotal) from pincodedetails where ROUND(subtotal) >= "+price+"
and resturantID="+selArgs+" limit 1) and resturantID ="+selArgs+" and ROUND(subtotal)
>= ( select ROUND(subtotal) from pincodedetails where ROUND(subtotal) <= "+price+"
and resturantID="+selArgs+" limit 1) order by ROUND(subtotal) LIMIT 1";
Database Helper Class:
double deliverycharge= 0;
if (mCursor.moveToFirst()) {
// Got first result
deliverycharge= mCursor.getDouble(0);
}
return deliverycharge;