Php programming SQL statement unionall usage programming

Source: Internet
Author: User
! IMG (img.ask.csdn.netupload201501281422411200_7720.8.png) IDs are ishijian1 and ishijian2, and the statements are cellspacing Programming php information.


The id is ishijian1, ishijian2, and the statement is

Echo '';

?>

Start time

Deadline



C_huizong.php
// Query orders
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. TC003 <=". $ _ POST ['1shijian2'];
Else
$ 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 <> '20180101' and TC003> = '20180101' AND TC003 <= '20180101'
Group 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 = '20180101' and TC003> = '20180101' AND TC003 <= '20180101'
Group 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> = '000000' AND TC003 <= '000000'
Group by leixing, bztdb ". $ shijian1. $ shijian2;

$ Result = mssql_query ($ query );
$ Row_num = mssql_num_rows ($ result );
If ($ row_num <= 10000 & $ row_num> 0)
{
Echo"
















While ($ row = mssql_fetch_assoc ($ result ))
{
Echo"

Echo"














echo"
\n";

}
Echo"

";Echo" ; ; ; ; ; ; ; ; ; ; ; ; ; "; "; ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";// Trace information
CategorySubdivisionColor temperatureOrder scaleStandard ticket submission ratioTargetingOrder QuantityExpected outputTotal warehouse receiving countStandard warehouse receivingSales volumeSales return quantityTracking information
". $ Row ['leixing']."". $ Row ['ifen']."". $ Row ['sewen']."". $ Row ['ddg']."". $ 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 )."Tracking information

 

";
Echo '';

}

Mssql_close ($ conn );

}
?>

The current one-line statement is incorrect. the query statement in the subsequent statement is incorrect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.