时间:2021-07-01 10:21:17 帮助过:4人阅读

$query = "Select top 35 A.Branchdesc,sum(B.Amount)total
From BaseBranch A Inner Join Retail B On A.BranchID=B.BranchID
Where B.DoneFlag=1 and B.DelFlag=0 and RetailType<>1 and Convert(varchar(12),B.WorkDate,112)='$searchdata'
Group by A.Branchdesc order by total desc";
$result = mssql_query($query);
echo "$searchdata 的销售为:";
echo "
| 门店 | 金额 | 
| $row[0] | $row[1] | 
$total = array('合计', 0);
while($row = mssql_fetch_array($result)) {
  echo "$row[0] $row[1] 
  $total[1] += $row[1];
}
echo "$total[0] $rotal[1] 
echo "";