我想将运费与小计进行比较并计算运费。我成功地得到了结果。我得到查询,然后在 Execute SQL 中执行该代码。我得到了正确答案。但
我在检索数据时遇到了一些问题。我每次只得到第一个位置值的结果。
下面我提到了我的代码。给我解决方案。
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";
数据库助手类:
double deliverycharge= 0;
if (mCursor.moveToFirst()) {
// Got first result
deliverycharge= mCursor.getDouble(0);
}
return deliverycharge;