두 SQL을 비슷하게 비교하는 방법에 대해 알아 보았습니다. 첫 번째 쿼리에서 현재 날짜를 사용하여 두 날짜와 두 번째 쿼리간에 계산됩니다.PHP : mysql_multi_query()를 사용하여 다중 쿼리를 실행하는 방법
PHP :
$sql="select all_dates.value1 as `Date`, sum(coalesce(`Inward(B_Qty)`, '0')) as `Inward`, sum(coalesce(`Outward(B_Qty)`, '0')) as `Outward`
from (select distinct M_Date as value1 from machine where J_Name = '180MLGMV' and DATE(M_Date) between '2016-06-01' and '2016-06-06'
union select distinct M_Date from machine where Pre_Req = '180MLGMV' and DATE(M_Date) between '2016-06-01' and '2016-06-06') as all_dates
left join (select M_Date, sum(A_Prod) AS `Inward(B_Qty)`
from machine where J_Name = '180MLGMV' and DATE(M_Date) between '2016-06-01' and '2016-06-06' group by M_Date)
as g on g.M_Date = all_dates.value1
left join(select M_Date, sum(NoBot) AS `Outward(B_Qty)`
from machine where Pre_req ='180MLGMV' and DATE(M_Date) between '2016-06-01' and '2016-06-06' group by M_Date)
as f on f.M_Date = all_dates.value1 group by all_dates.value1 ;" ;
$sql.="select all_dates.value1 as `Date`, sum(coalesce(`Inward(B_Qty)`, '0')) as `Inward`, sum(coalesce(`Outward(B_Qty)`, '0')) as `Outward`
from (select distinct M_Date as value1 from machine where J_Name = '180MLGMV' and M_Date='2016-06-07'
union select distinct M_Date from machine where Pre_Req = '180MLGMV' and M_Date='2016-06-07') as all_dates
left join (select M_Date, sum(A_Prod) AS `Inward(B_Qty)`
from machine where J_Name = '180MLGMV' and M_Date='2016-06-07' group by M_Date)
as g on g.M_Date = all_dates.value1
left join(select M_Date, sum(NoBot) AS `Outward(B_Qty)`
from machine where Pre_req ='180MLGMV' and M_Date='2016-06-07' group by M_Date)
as f on f.M_Date = all_dates.value1 group by all_dates.value1 ";
$list1=mysqli_multi_query($sql,$con);
while($row_list1=mysql_fetch_array($list1))
{
$b=$b+$row_list1['Inward'];
$c=$c+$row_list1['Outward'];
}
안쪽과 바깥쪽으로 각각 Query.I의 날짜의 데이터를 검색하는 네 개의 데이터를 검색 할 mysqli_multi_query 아래 작성해야 무엇을 의미하는 방법을 제안 해주십시오.
미리 감사드립니다.
http://www.w3schools.com/php/func_mysqli_multi_query.asp를 방문하십시오. 명확한 아이디어를 가지고 있습니다. –
@RyanVincent 사실 저는 이미 쿼리를 시도했지만 절대적으로 잘 작동하고 있습니다. 값을 검색하는 것과 관련하여 혼란스러워졌습니다. – Babaji
@NanaPartykar 예. 그만 갈 것입니다. 고마워요. – Babaji