当前位置:网站首页>MySQL circularly adds sequence numbers according to the values of a column
MySQL circularly adds sequence numbers according to the values of a column
2022-04-23 05:03:00 【Great Wall ol】
A table has a primary key id, One job number . Now the job number repeats , Find out all the duplicate data of the job number , And add... After the job number of these data 01,02,03
SELECT
rownu,
tb.jobid,
(rownum1 - d.minvalue)
FROM
(
SELECT
@rownum1 :=@rownum1 + 1 AS rownum1,
jobid
FROM
tablea,
(SELECT @rownum1 := 0) t
) tb
LEFT JOIN (
SELECT
min(rownum) minvalue,
jobid
FROM
(
SELECT
@rownum :=@rownum + 1 AS rownum,
jobid
FROM
tablea,
(SELECT @rownum := 0) t
) tc
GROUP BY
jobid
) d ON (tb.jobid = d.jobid);
The effect is as follows

版权声明
本文为[Great Wall ol]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220552270339.html
边栏推荐
- The applet calls the function of scanning QR code and jumps to the path specified by QR code
- [2022 ICLR] Pyraformer: Low-Complexity Pyramidal Attention for Long-Range 时空序列建模和预测
- Informatics Olympiad 1955: [11noip popularization group] Swiss round | openjudge 4.1 4363: Swiss round | Luogu p1309 [noip2011 popularization group] Swiss round
- Learning Android from scratch -- baseactivity and activitycollector
- Unity C# 网络学习(四)
- The 2021 more reading report was released, and the book consumption potential of post-95 and Post-00 rose
- 多线程基本概念(并发与并行、线程与进程)和入门案例
- MySQL views the SQL statement details executed by the optimizer
- The difference between static pipeline and dynamic pipeline
- 【数据库】MySQL基本操作(基操~)
猜你喜欢

Deep learning notes - data expansion

深度学习笔记 —— 数据增广

CLion+OpenCV identify ID number - detect ID number

直播带货表格模板-自动显示图片-自动关联系列商品

【数据库】MySQL基本操作(基操~)

深度学习笔记 —— 微调

redis数据类型有哪些

多线程基本概念(并发与并行、线程与进程)和入门案例

The 8 diagrams let you see the execution sequence of async / await and promise step by step
![[WinUI3]编写一个仿Explorer文件管理器](/img/3e/62794f1939da7f36f7a4e9dbf0aa7a.png)
[WinUI3]编写一个仿Explorer文件管理器
随机推荐
MySQL slow query
SCP command details
View analysis of scenic spots in ArcGIS
Innovation training (IV) preliminary preparation - server
The vscode ipynb file does not have code highlighting and code completion solutions
C list field sorting contains numbers and characters
Jetpack -- lifecycle usage and source code analysis
js 判断数字字符串中是否含有字符
Perfect test of coil in wireless charging system with LCR meter
Solve valueerror: argument must be a deny tensor: 0 - got shape [198602], but wanted [198602, 16]
DIY 一个 Excel 版的子网计算器
Gets all dates between two times
C# List字段排序含有数字和字符
Repair of self calibration SPC failure of Tektronix oscilloscope dpo3054
Mac enters MySQL terminal command
Day. JS common methods
HRegionServer的详解
Sword finger offer: push in and pop-up sequence of stack
MySQL -- execution process and principle of a statement
redis数据类型有哪些