当前位置:网站首页>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
边栏推荐
- Excel uses the functions of replacement, sorting and filling to comprehensively sort out financial data
- Unity C e-learning (IV)
- 和谐宿舍(线性dp / 区间dp)
- [winui3] write an imitation Explorer file manager
- Informatics Olympiad 1955: [11noip popularization group] Swiss round | openjudge 4.1 4363: Swiss round | Luogu p1309 [noip2011 popularization group] Swiss round
- Painless upgrade of pixel series
- redis和mysql区别
- 2022/4/22
- Implementation of switching windows and capturing data in selenium mode
- PHP 统计指定文件夹下文件的数量
猜你喜欢

Innovation training (IV) preliminary preparation - server

Opencv + clion face recognition + face model training

Use model load_ state_ Attributeerror appears when dict(): 'STR' object has no attribute 'copy‘

Live delivery form template - automatically display pictures - automatically associate series products

Sword finger offer: the path with a certain value in the binary tree (backtracking)

DIY is an excel version of subnet calculator

Introduction to raspberry pie 3B - system installation

Download PDF from HowNet (I don't want to use CAJViewer anymore!!!)
![[database] MySQL single table query](/img/27/99d174219109ea7a455cfdf55e0996.png)
[database] MySQL single table query

Details related to fingerprint payment
随机推荐
L2-011 play binary tree (build tree + BFS)
MySQL slow query
Deep learning notes - semantic segmentation and data sets
How to exit VIM
2022/4/22
Day.js 常用方法
POI export message list (including pictures)
Learning Android V from scratch - UI
CLion+OpenCV identify ID number - detect ID number
DIY is an excel version of subnet calculator
[WinUI3]编写一个仿Explorer文件管理器
The object needs to add additional attributes. There is no need to add attributes in the entity. The required information is returned
Pixel 5 5g unlocking tutorial (including unlocking BL, installing edxposed and root)
Thoughts on a small program
MySQL uses or to query SQL, and SQL execution is very slow
QPushButton slot function is triggered multiple times
《2021多多阅读报告》发布,95后、00后图书消费潜力攀升
The WebService interface writes and publishes calls to the WebService interface (I)
Wechat payment function
[database] MySQL single table query