MySQL data formatting statement file record body format sequence number domain name length bit set instructions 1 record body mark www.2cto.com 2 1-2 fill in "50" 2 ticket generation date 8 3-10 YYYYMMDD 3 SP enterprise code 20 11-30 SP enterprise code is the same as the SP enterprise code in the file name, right alignment, left fill space 4 Business Code 20 31-50 do not include free business www.2cto.com left alignment, right fill space 5 Billing type 2 51-52 01: Times 02: monthly subscription 03: package day 04: Package 6 charges 5 53-57 unit: points do not retain decimal places, decimal places rounded to the right alignment, the proportion of SP in the left-side population 07 is www.2cto.com 4 58-61 SP * 1000 pure number, which is right aligned with integers without decimal points and percentages. The value range of left-side Population 0 is as follows: 0000-10008 number of tickets 11 62-72 Number of tickets successfully billed. If no charge or query type is included, the ticket is aligned to the right, enter the province code for paying user ownership 3 73-75 enter the province code for paying user ownership, encoding rules are the same as reconciliation Responsibility unit code 10 Total Information fee 12 76-87 unit: pure number, decimal places are not retained, and decimal places are rounded to the right, 0 left fill www.2cto.com Total Information fee = number of tickets * 11 charges reserved field 1 31 88-118 fill in space 12 press Enter 1 119 Carriage Return 13 www.2cto.com Line Feed 1 120 Line Feed 01 select concat (02 '50 ', 03. t, 04 LPAD ('000000', 20, ''), 05 RPAD (. serviceid, 20, ''), 06 '01', 07 LPAD ('000000', 5, '0'), 08 LPAD ('000000', 4, '0'), 09 LPAD (. total, 11, 0), 10 '123', 11 LPAD (. sumeda, 12, 0), 12 REPEAT ('', 31), 13 www.2cto.com '\ R', 14' \ n' 15) 16FROM17 (18 select left (log_time, 8) AS t, serviceid, COUNT (*) AS total, SUM (feecode) AS sumfee19 FROM20 mt_log_20151121 WHERE22 spcode = '000000' AND region = '000000' AND feecode> 023 group by t, serviceid24) a generated File 01 mysql-uroot-f spservice-Ne "02 select concat (03 '50', 04 www.2cto.com. t, 05 LPAD ('000000', 20, ''), 06 RPAD (. serviceid, 20, ''), 07 '01', 08 LPAD ('000000', 5, '0'), 09 LPAD ('000000', 4, '0'), 10 LPAD (. total, 11, 0), 11 '123', 12 LPAD (. sumeda, 12, 0), 13 REPEAT ('', 31), 14' \ r'15) 16FROM17 (18 select left (log_time, 8) AS t, serviceid, COUNT (*) AS total, SUM (feecode) AS sumfee19 FROM20 www.2cto.com mt_log_20151121 WHERE22 spcode = '000000' AND region = '000000' AND feecode> 023 group by t, serviceid24) a25 "> spdz_00000090107700000000000000_590000201107.txt &