当前位置:网站首页>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 :

边栏推荐
- SQL language (6)
- 如何判断静态代码质量分析工具的性能?这五大因素必须考虑
- SQL注入 Less17(报错注入+子查询)
- 圆角大杀器,使用滤镜构建圆角及波浪效果!
- 【mysql学习08】
- Only know that the preform is used to generate objects? See how I use unity to generate UI prefabs
- flinksql client 连接kafka select * from table没有数据报错,如何解决?
- varest蓝图设置json
- Brief description of model deployment
- [IJCAI 2022] parameter efficient large model sparse training method, which greatly reduces the resources required for sparse training
猜你喜欢

小区蔬菜配送的小程序

Teach you how to configure S2E as the working mode of TCP server through MCU

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

全网显示 IP 归属地,是怎么实现的?

The most efficient note taking method in the world (change your old version of note taking method)

城市雕塑典型作品信息管理系统(图片分享系统SSM)

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

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

SQL injection LESS18 (header injection + error injection)

ArcMap cannot start the solution
随机推荐
Use three.js to realize the cool cyberpunk style 3D digital earth large screen
W5500通过上位机控制实现调节LED灯带的亮度
Reflection reflection
Similarity matrix, diagonalization condition
【IMX6ULL笔记】--内核底层驱动初步探究
Flinksql client connection Kafka select * from table has no data error, how to solve it?
Greedy problem 01_ Activity arrangement code analysis
SQL language (III)
Want to record your supernatural moments when playing games? Let's take a look at how to use unity screenshots
[recursion] 938. Range and of binary search tree
SQL language (6)
Reinforcement learning (IV)
如何判断静态代码质量分析工具的性能?这五大因素必须考虑
黑客入门教程(非常详细)从零基础入门到精通,看完这一篇就够了。
Reptile foundation I
JS运算符
Leetcode sword finger offer 27. image of binary tree
硬件外设=maixpy3
My colleague looked at my code and exclaimed: how can I use a singleton in unity
第4章线性方程组