当前位置:网站首页>Schedule 1 string splicing and inserting into schedule 2sql output process record
Schedule 1 string splicing and inserting into schedule 2sql output process record
2022-06-09 18:55:00 【51CTO】
Requirements describe :
A detailed list 1:formtable_main_46_dt1
Field :id,mainid, bxmx1, jshj, kmbm, fyxm
A detailed list 4:formtable_main_46_dt4
Field :id,mainid,zy,kmbm,jdbmbm,fyxmbm,yfxmbm,jfje
- fyxm For welfare expenses (56) The data of .
- bxmx1 Splicing ,”/” interval (mysql Result set row splicing group_concat).
- jshj Take the total (sum).
- Insert into parts list 4.
- Same as main table , therefore mainid identical .
Output process :
- View the parts list 1 data .
- select mainid, bxmx1, jshj, kmbm, fyxm from formtable_main_46_dt1;

- Find one. demo data ,mainid=62, And filter the data that meets the conditions ,fyxm=56
- select mainid, bxmx1, jshj, kmbm, fyxm from formtable_main_46_dt1 where mainid=62 and fyxm =56

- Try string merging group_concat
- select group_concat(bxmx1) from formtable_main_46_dt1 where mainid=62 and fyxm =56

- Replace comma with ‘/’
- select REPLACE(group_concat(bxmx1),',','/') as zy from formtable_main_46_dt1 where mainid=62 and fyxm =56

- Sum the amount
- select REPLACE(group_concat(bxmx1),',','/') as zy ,sum(jshj) as jfje from formtable_main_46_dt1 where mainid=62 and fyxm =56

- Add additional fields
- select mainid,REPLACE(group_concat(bxmx1),',','/') as zy ,kmbm,sum(jshj) as jfje from formtable_main_46_dt1 where mainid=62 and fyxm =56

- Improve compatibility , Add group by
- select mainid,REPLACE(group_concat(bxmx1),',','/') as zy ,kmbm,sum(jshj) as jfje from formtable_main_46_dt1 where mainid=62 and fyxm =56 group by fyxm

- Change it to insert into Complete the field before the statement
- select mainid,REPLACE(group_concat(bxmx1),',','/') as zy,kmbm,null as jdbmbm,null as fyxmbm,null as yfxmbm,sum(jshj) as jfje from formtable_main_46_dt1 where mainid=62 and fyxm =56 group by fyxm;

- Change it to insert into sentence ( Caution in testing )
- INSERT INTO formtable_main_46_dt4 ( mainid,zy,kmbm,jdbmbm,fyxmbm,yfxmbm,jfje) select mainid,REPLACE(group_concat(bxmx1),',','/') as zy,kmbm,null as jdbmbm,null as fyxmbm,null as yfxmbm,sum(jshj) as jfje from formtable_main_46_dt1 where mainid=62 and fyxm =56 group by fyxm;
边栏推荐
- 220609-R
- Structure design of high pressure differential probe
- Jsonpath tutorial
- How to set up wireless host link communication between Kingview and OMRON PLC?
- Application of oscilloscope probe in switch loss test scheme
- 【SOLIDWORKS-详细记录】解决默认模板无效问题及添加自定义模板
- MySQL启动失败的原因是什么及如何解决
- C# 32. Select a network card from the static class implementation drop-down box
- IEDA 安装actiBPM插件
- 图解|高性能服务器设计之缓存系统一致性
猜你喜欢

刷脸认证如何实现人脸又快又准完成校验?

What is the difference between MySQL delete, truncate and drop

How to improve the click through rate of push messages through a/b testing?

Introduction to Multivariate Statistics

IEDA 安装actiBPM插件
![Leetcode: Sword finger offer 56 - I. number of occurrences in the array [grouping XOR]](/img/87/ffcadcc4542b06e7f0da375178bbcc.png)
Leetcode: Sword finger offer 56 - I. number of occurrences in the array [grouping XOR]

mfc连接数据库显示未发现数据源名称并且未指定默认驱动程序

Example analysis of five data types in redis

Win10 installs wsl1 on disks D, e and F

How to reduce noise by measuring current probe
随机推荐
As a programming ape, do you really know how to operate Google browser
Illustration | cache system consistency for high performance server design
Win10 installs wsl1 on disks D, e and F
Application of oscilloscope probe in switch loss test scheme
Pcap 文件
How to improve the click through rate of push messages through a/b testing?
为何罗氏探头测量高频电流会出现误差?
Redis的五种数据类型实例分析
2022 SME Digital Forum held 360 Enterprise Security Cloud release new upgrade
20220529-mks格式的字幕怎么转换成srt、ass、ssa、idx格式的字幕.txt
DBeaver中如何调整SQL编辑器的字体大小
20220603怎么查询公网IP
Goldfish rhca memoirs: do447 management list -- compile yaml list file
leetcode:剑指 Offer 56 - I. 数组中数字出现的次数【分组异或】
This article explains in detail three ways for PHP to connect to MySQL database
Qt数据库应用21-数据分组导出
What software is foreign exchange transaction MT4? What is the difference between MT4 and MT5? What should I pay attention to when downloading MT4?
2022年开什么实体店比较赚钱?适合女性做的小成本开店,叶其芳大健康
评“开发人员不喜欢低代码和无代码的8个理由”
陈某的技术交流群招人~