当前位置:网站首页>MySQL historical data supplement new data
MySQL historical data supplement new data
2022-07-25 11:46:00 【Who makes perfect -lwp】
-- Work order display form The work order supplements the data of equipment type for the maintenance type of on-board terminal
BEGIN;
-- 609032009808957447
SELECT @maxid := max(id)+ 1 FROM `dst_work_order`.`tbl_work_order_show` ;
INSERT INTO `dst_work_order`.`tbl_work_order_show` ( `id`, `work_order_id`, `name`, `value`, `type`, `sort` )
SELECT
@maxid := @maxid + 1,
w.id AS work_order_id,
' Device type ',
'T-Box',
0,
7
FROM
(
SELECT
d.id
FROM
(
SELECT
a.id
FROM
(
SELECT
t.id
FROM
tbl_work_order t,
tbl_work_order_show b
WHERE
t.type = 4
AND t.id = b.work_order_id
) a
GROUP BY
a.id
) d
WHERE
d.id NOT IN (
SELECT
d.id
FROM
(
SELECT
a.id
FROM
(
SELECT
t.id
FROM
tbl_work_order t,
tbl_work_order_show b
WHERE
t.type = 4
AND t.id = b.work_order_id
AND b.NAME = ' Device type '
) a
GROUP BY
a.id
) d
)
) w,
( SELECT @maxid := 0 ) ind,
( SELECT @maxid := max(id)+ 1 FROM `dst_work_order`.`tbl_work_order_show` ) tmp;
COMMIT;-- Validate the data script
select d.id from (SELECT
a.id
FROM
(SELECT
t.id
FROM
tbl_work_order t,
tbl_work_order_show b
WHERE
t.type = 4
AND t.id = b.work_order_id ) a
GROUP BY
a.id ) d where d.id not in(
select d.id from (SELECT
a.id
FROM
(SELECT
t.id
FROM
tbl_work_order t,
tbl_work_order_show b
WHERE
t.type = 4
AND t.id = b.work_order_id and b.name =' Device type ' ) a
GROUP BY
a.id ) d );1、 scene tbl_work_order Work order form ,tbl_work_order_show Work order data display table The historical data is added to the work order data display table
2、 The original work order display table of historical data has no equipment type data , Due to the addition of equipment types , If there is no work order type of historical data, you need to add the equipment type data
3、 Set the type equal to 4 Add equipment type data to the display table of vehicle terminal maintenance ,
The effect is as shown in the picture :

边栏推荐
- 【mysql学习09】
- 活动报名 | 玩转 Kubernetes 容器服务提高班正式开营!
- 如何解决“W5500芯片在TCP_Client模式下,断电重启之后无法立即连接到服务器”的问题
- 基于W5500实现的考勤系统
- SQL language (V)
- SQL language (4)
- Some errors of tensorflow calling multiple GPUs
- 常见WEB攻击与防御
- The most efficient note taking method in the world (change your old version of note taking method)
- Shell Chapter 7 exercise
猜你喜欢

活动报名 | 玩转 Kubernetes 容器服务提高班正式开营!

Learn NLP with Transformer (Chapter 1)

如何解决“W5500芯片在TCP_Client模式下,断电重启之后无法立即连接到服务器”的问题

软件测试阶段的风险

SQL注入 Less23(过滤注释符)

Want to record your supernatural moments when playing games? Let's take a look at how to use unity screenshots

SQL language (III)

toString()与new String()用法区别

教你如何通过MCU配置S2E为TCP Client的工作模式

任何时间,任何地点,超级侦探,认真办案!
随机推荐
模型部署简述
Want to record your supernatural moments when playing games? Let's take a look at how to use unity screenshots
世界上最高效的笔记方法(改变你那老版的记笔记方法吧)
Game backpack system, "inventory Pro plug-in", research and learning ----- mom doesn't have to worry that I won't make a backpack anymore (unity3d)
小微企业智能名片管理小程序
W5500上传温湿度到oneNET平台
Shell Chapter 5 homework
JS作用域以及预解析
Detailed explanation of lvs-nat and lvs-dr modes of LVS load balancing
Dynamic planning question 05_ Missile interception
用 Redis 做一个可靠的延迟队列
2022 年中回顾|一文看懂预训练模型最新进展
活动报名 | 玩转 Kubernetes 容器服务提高班正式开营!
JDBC summary
MIIdock简述
第4章线性方程组
toString()与new String()用法区别
Detailed explanation of zero basis from macro to micro Bert
Hacker introductory tutorial (very detailed) from zero basic introduction to proficiency, it is enough to read this one.
"Mqtt protocol explanation and Practice (access to onenet)" of wiznet w5500 series training activities