php编程SQL语句union all的使用编程
id分别是ishijian1,ishijian2,语句是
echo ' ';
?>
起始时间
截止时间
c_huizong.php
//订单查询
if ($_POST['1shijian1'])
{
echo "
document.getElementById('1shijian1').value='".$_POST['1shijian1'].
"';document.getElementById('1shijian2').value='".$_POST['1shijian2'].
"';cg1name();";
if ($_POST['1shijian1']NULL)
$shijian1=" and COPTC.TC003>=".$_POST['1shijian1'];
else
$shijian1="";
if ($_POST['1shijian2']NULL)
$shijian2=" and COPTC.TC003else
$shijian2="";
require_once('i_code/connect.php');
$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
FROM chaxun
LEFT JOIN DDTJMX ON MA003=leixing and xifen=XIFEN AND sewen=DDTJMX.UDF10 AND ddgm=DDGM and daba=XINGHAO
left join COPTC on TC001=DDTJMX.TD001 AND TC002=DDTJMX.TD002
where xifen'' and xifen'5050' and TC003>='20150110' AND TC003GROUP BY leixing,xifen,sewen,ddgm,bztdb,daba
union all
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
FROM chaxun
LEFT JOIN DDTJMX ON MA003=leixing and xifen=XIFEN
left join COPTC on TC001=DDTJMX.TD001 AND TC002=DDTJMX.TD002
where xifen='5050' and TC003>='20150110' AND TC003GROUP BY leixing,xifen,bztdb
union all
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
FROM chaxun
LEFT JOIN DDTJMX ON MA003=leixing
left join COPTC on TC001=DDTJMX.TD001 AND TC002=DDTJMX.TD002
where xifen='' and TC003>='20150110' AND TC003GROUP BY leixing,bztdb".$shijian1.$shijian2;
$result=mssql_query($query);
$row_num=mssql_num_rows($result);
if ($row_num0)
{
echo "
";
echo "类别 ;
细分 ;
色温 ;
订单规模 ;
标准投单比 ;
打靶 ;
订单量 ;
预计产量 ;
总入库数 ;
标准入库 ;
销货数量 ;
销退数量 ;
跟踪信息 ;
";while($row=mssql_fetch_assoc($result))
{
echo"
";echo"
".$row['leixing']." ";
echo"".$row['xifen']." ";
echo"".$row['sewen']." ";
echo"".$row['ddgm']." ";
echo"".$row['bztdb']." ";
echo"".$row['daba']." ";
echo"".number_format($row['TD008'],0)." ";
echo"".number_format($row['TA015'],0)." ";
echo"".number_format($row['RKZS'],0)." ";
echo"".number_format($row['D310'],0)." ";
echo"".number_format($row['TH008'],0)." ";
echo"".number_format($row['TJ007'],0)." ";
echo"跟踪信息 ";
//跟踪信息echo"
\n";}
echo"
";
echo'';}
mssql_close($conn);
}
?>
现在一运行语句是错的,是后面的语句里面的查询语句有错,求指正。
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
相关文章
相关视频
-
详解win10下PHP的安装配置(以php5.6为...
-
php Swoole实现毫秒定时计划任务(详解)
-
【DTM】PHP协程客户端v0.1 beta版本发...
-
PHP中类的理解和应用[一]_PHP教程
-
php编程SQL语句union all的使用编程
专题推荐
-
独孤九贱-php全栈开发教程
全栈 170W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
-
玉女心经-web前端开发教程
入门 80W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
-
天龙八部-实战开发教程
实战 120W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习
- 最新文章
- 热门排行
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论