<?php
$spp="SELECT count(genneration_size.order_generation) AS V_TOTAL1 , SUM(genneration_size.size_new) AS V_TOTAL
, count(genneration_size_new.order_generation) AS V_TOTAL1_new , SUM(genneration_size_new.order_size) AS V_TOTAL_new
FROM genneration_size , genneration_size_new
WHERE genneration_size.order_generation='ASD' or genneration_size.order_generation='CSD' or genneration_size.order_generation='HRG' or genneration_size.order_generation='LBG' or genneration_size.order_generation='LSD' or genneration_size.order_generation='OBD' or genneration_size.order_generation='PFR' or genneration_size.order_generation='RAL' or genneration_size.order_generation='WSG' or genneration_size.order_generation='$hdata' or genneration_size_new.order_generation='$hdata'
GROUP BY genneration_size.order_generation";
$qu=mysql_query($spp);
while($arr=mysql_fetch_array($qu)){
$order_generation1=$arr['genneration_size.order_generation'];
$order_generation2=$arr['genneration_size_new.order_generation'];
echo $data1[]= $arr[V_TOTAL1]."=count Last".$order_generation1."<br>";
echo $data2[] = $arr[V_TOTAL]."=sum Last"."<br>";
echo $data1_new[]= $arr[V_TOTAL1_new]."=count new".$order_generation2."<br>";
echo $data2_new[] = $arr[V_TOTAL_new]."=sum new"."<br>";
echo "-----------------------------------------------------------------------"."<br>";
}
ผลลัพธ์
156240 = count Last // ค่านี้ กับ count new เหมือนกัน ครับ แต่ ค่าจริง ไม่เท่่ากัน ครับ
187475723.846741 =sum Last
156,240 = count new // ค่าเหมือนกัน กับ count last
495839968.944077 = sum new
---------------------------------- -------------------------------------
?>