我的mysql有问题,我有这样的查询
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
float area = 0.0;
float totalarea = 0.0;
float dx;
float x = 0.0;
cout << "number of rectangles?:";
cin >> n;
dx = 1.0/n;
for (int i=1; i<=n; i++){
area = (1./n) * pow(1.0 - pow(x,2.0),0.5) ;
totalarea += area;
x = x + dx;
}
cout << totalarea << endl;
return 0;
}
结果显示
SELECT sum(Qty) AS Qty FROM sap_rekap_bc23
INNER JOIN masterunit_sap ON masterunit_sap.unit = sap_rekap_bc23.Unit WHERE Qty>0 AND invno='T62TJ92013'
GROUP BY HS_Code,HS_Desc,unit_tpb,Curr,Price,invno
但是当我尝试使用我的代码(在PHP上)插入到另一个表中
Qty = 3144.6
我在$qryuraian = "SELECT sum(Qty) AS Qty FROM sap_rekap_bc23
INNER JOIN masterunit_sap ON masterunit_sap.unit = sap_rekap_bc23.Unit
WHERE Qty>0 AND invno='T62TJ92013' GROUP BY HS_Code,HS_Desc,unit_tpb,Curr,Price,invno";
$listuraian = mysql_query($qryuraian,$conn);
while($item=mysql_fetch_array($listuraian))
{
$inserttmp = "INSERT INTO tmp_sap_rekap_bc23 (Qty)
VALUES ('".$item['Qty']."')";
//mysql_query($inserttmp,$connweb);
}
上的Qty
的结果显示tmp_sap_rekap_bc23
。为什么我的数据瞬间变得四舍五入?我在3145
上的桌子tmp_sap_rekap_bc23
竟然是field Qty
?有什么想法吗?
答案 0 :(得分:0)
发现我的问题!!
是我的错。我将Qty
上的字段tmp_sap_rekap_bc23
设置为225而不是0。所以我更改为0。中提琴恢复正常。