P00481708010002 20 20
According to the P00481708010002 number above the raw data
Finally become
P00481708010002 38 38
P00481708010002 38 38
To ensure that there are two data cannot be integrated into a data!!!!!!!!!!!!!!! Only the amount change into 38
The original code
The SELECT cyhq_u_orderdish. Ch_branchno as' name ', -- -- name
T_hq_branch_info vch_company,
. - (select t_hq_branch_info vch_company from t_hq_branch_info) as the 'name',
Cyhq_u_orderdish. Ch_payno as' statement no. '
Cyhq_u_orderdish ch_billno as' order number, number - order
Cyhq_u_orderdish. Ch_dishno as' product code, -- -- product code
(SELECT vch_dishname FROM cybr_bt_dish WHERE ch_dishno=cyhq_u_orderdish. Ch_dishno) as' name '-- name cyhq_u_orderdish. Num_price_org - the convert (a decimal (10, 2), cyhq_u_orderdish. Num_price_org + num_price_add - 1.0/100 (cyhq_u_orderdish. Int_discount * * (cyhq_u_orderdish. Num_price_org + num_price_add)))) as' actual amount, cyhq_u_orderdish. Num_price_org as' sales amount,
Convert (a decimal (1, 2), cyhq_u_orderdish. Num_price_org + num_price_add - 1.0/100 (cyhq_u_orderdish. Int_discount * * (cyhq_u_orderdish. Num_price_org + num_price_add))) as' discount amount,
Cyhq_u_orderdish. Num_price_add as' mark-up '
The from cyhq_u_orderdish left join t_hq_branch_info on t_hq_branch_info. Ch_branchno=cyhq_u_orderdish. Ch_branchno
Where cyhq_u_orderdish. Ch_payno='P00481708010002'
The cyhq_u_orderdish ch_payno is P00481708010002 cyhq_u_orderdish. Num_price_org is the first line the 18 of 20
CodePudding user response:
Is added between the column?select field 1 + 2 as field 1, 2 + field 1 as field from table 2
CodePudding user response:
Is sum up and down, not horizontallyCodePudding user response:
Col1, col2, col3P00481708010002, 18, 19
P00481708010002, 20, 20
The select table1. Col1 v.c ol2, v.c ol3
The from table1 inner join (select col1, sum (col2) as c2, sum (col3) as c3 from table1 group by col1) v on table1. The col1=v.c ol1
CodePudding user response:
XiazisrJunction post rate: 0%