首页 > 后端开发 > php教程 > php编程SQL语句union all的使用编程

php编程SQL语句union all的使用编程

WBOY
发布: 2016-06-02 11:33:19
原创
1188 人浏览过

编程php信息

php编程SQL语句union all的使用编程
id分别是ishijian1,ishijian2,语句是

echo ' ';

?>

<code><td valign="top" style="width:903; "> <table border="0" cellspacing="1" cellpadding="1" align="center">
<tr>
<td title="格式:8位数字 示例:20131231默认搜索当前三个月内的订单要搜索之前的订单请修改或清空本项">
<p align="center">起始时间</p>
<table border="0" cellspacing="1" cellpadding="1" align="center">
<tr>
<td title="格式:8位数字 示例:20131231默认搜索当前三个月内的订单要搜索之前的订单请修改或清空本项"><p align="center">起始时间</p></td>      <td title="格式:8位数字 示例:20131231默认搜索当前三个月内的订单要搜索之前的订单请修改或清空本项" width="165"></td>          </tr>
<tr>
<td title="格式:8位数字 示例:20140115"><p align="center">截止时间<br></p></td>      <td title="格式:8位数字 示例:20140115"></td>            <td><p align="center">                         </p></td>    </tr>
</table>
</td>      <td title="格式:8位数字 示例:20131231默认搜索当前三个月内的订单要搜索之前的订单请修改或清空本项" width="165"></td>          </tr>
<tr>
<td title="格式:8位数字 示例:20140115">
<p align="center">截止时间</p>
<p><br></p>
</td>      <td title="格式:8位数字 示例:20140115"></td>            <td><p align="center">                         </p></td>    </tr>
</table>
<br><p></p>
<p><br><br><br>c_huizong.php<br><?php <br>//订单查询</p>if ($_POST['1shijian1'])<p>{<br>echo "<br>document.getElementById('1shijian1').value='".$_POST['1shijian1'].<br>"';document.getElementById('1shijian2').value='".$_POST['1shijian2'].<br>"';cg1name();";<br><br>if ($_POST['1shijian1']NULL)</p>$shijian1=" and COPTC.TC003>=".$_POST['1shijian1'];<p>else<br>$shijian1="";<br><br>if ($_POST['1shijian2']NULL)</p>$shijian2=" and COPTC.TC003else$shijian2="";<p><br>require_once('i_code/connect.php');<br><br>$query="select leixing,xifen,sewen,ddgm,bztdb,daba,SUM(TD008) AS TD008,SUM(TA015)TA015,SUM(RKZS)RKZS,SUM(D310)D310,SUM(D305)D305,SUM(D304)D304,SUM(D3023)D3023,SUM(TH008)TH008,SUM(TJ007)TJ007<br>FROM chaxun<br>LEFT JOIN DDTJMX ON MA003=leixing and xifen=XIFEN AND sewen=DDTJMX.UDF10 AND ddgm=DDGM and daba=XINGHAO <br>left join COPTC on TC001=DDTJMX.TD001 AND TC002=DDTJMX.TD002 <br>where xifen'' and xifen'5050' and TC003>='20150110' AND TC003GROUP BY leixing,xifen,sewen,ddgm,bztdb,daba<br>union all<br>select leixing,xifen,null as sewen,null as ddgm,bztdb,null as daba,SUM(TD008) AS TD008,SUM(TA015)TA015,SUM(RKZS)RKZS,SUM(D310)D310,SUM(D305)D305,SUM(D304)D304,SUM(D3023)D3023,SUM(TH008)TH008,SUM(TJ007)TJ007<br>FROM chaxun<br>LEFT JOIN DDTJMX ON MA003=leixing and xifen=XIFEN <br>left join COPTC on TC001=DDTJMX.TD001 AND TC002=DDTJMX.TD002 <br>where  xifen='5050' and TC003>='20150110' AND TC003GROUP BY leixing,xifen,bztdb<br>union all <br>select leixing,null as xifen,null as sewen,null as ddgm,bztdb, null as daba,SUM(TD008) AS TD008,SUM(TA015)TA015,SUM(RKZS)RKZS,SUM(D310)D310,SUM(D305)D305,SUM(D304)D304,SUM(D3023)D3023,SUM(TH008)TH008,SUM(TJ007)TJ007<br>FROM chaxun<br>LEFT JOIN DDTJMX ON MA003=leixing</p>left join COPTC on TC001=DDTJMX.TD001 AND TC002=DDTJMX.TD002 <p>where xifen='' and TC003>='20150110' AND TC003GROUP BY leixing,bztdb".$shijian1.$shijian2;<br><br>$result=mssql_query($query);<br>$row_num=mssql_num_rows($result);</p>if ($row_num0)<p>{</p>echo "<table align="center" cellspacing="0" cellpadding="0">
<br><tr align="center">";<br>echo "<th>类别</th>;<br><th>细分</th>;<br><th>色温</th>;<br><th>订单规模</th>;<br><th>标准投单比</th>;<br><th>打靶</th>;<br><th>订单量</th>;<br><th>预计产量</th>;<br><th>总入库数</th>;<br><th>标准入库</th>;<br><th>销货数量</th>;<br><th>销退数量</th>;<br><th>跟踪信息</th>;<br>
</tr>";<p>while($row=mssql_fetch_assoc($result))<br>{<br>    echo"</p>
<tr align="center">";<p>echo"</p>
<td>".$row['leixing']."</td>";<br>    echo"<td>".$row['xifen']."</td>";<br>    echo"<td>".$row['sewen']."</td>";<br>    echo"<td>".$row['ddgm']."</td>";<br>    echo"<td>".$row['bztdb']."</td>";<br>    echo"<td>".$row['daba']."</td>";<br>    echo"<td>".number_format($row['TD008'],0)."</td>";<br>    echo"<td>".number_format($row['TA015'],0)."</td>";<br>    echo"<td>".number_format($row['RKZS'],0)."</td>";<br>    echo"<td>".number_format($row['D310'],0)."</td>";<br>    echo"<td>".number_format($row['TH008'],0)."</td>";<br>    echo"<td>".number_format($row['TJ007'],0)."</td>";<br>    echo"<td>跟踪信息</td>";<br>    //跟踪信息<pre class="brush:php;toolbar:false"><code>echo"</code>
登录后复制
\n";

}
echo"


";

echo "

;;

;;

;
;;

;;;;;;";while($row=mssql_fetch_assoc($result)){ echo"";echo""; echo""; echo""; echo""; echo""; echo""; echo""; echo""; echo""; echo""; echo""; echo""; echo""; //跟踪信息}echo"
类别细分 色温订单规模 标准投单比打靶订单量 预计产量总入库数标准入库销货数量销退数量跟踪信息
".$row['leixing']."".$row['xifen']."".$row['sewen']."".$row['ddgm']."".$row['bztdb']."".$row['daba']."".number_format($row['TD008'],0)."".number_format($row['TA015'],0)."".number_format($row['RKZS'],0)."".number_format($row['D310'],0)."".number_format($row['TH008'],0)."".number_format($row['TJ007'],0)."跟踪信息
 ";echo'';}mssql_close($conn);}?>现在一运行语句是错的,是后面的语句里面的查询语句有错,求指正。
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板