mysql 实现序号化数字中 缺失的数字

Posted IT的鱼

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 实现序号化数字中 缺失的数字相关的知识,希望对你有一定的参考价值。

SELECT
	( SELECT IFNULL(max(CAST( commodity_number AS SIGNED )),0) + 1 FROM ( SELECT commodity_number FROM sys_commodity WHERE company_id = '950872849940217856' ) AS b   WHERE commodity_number < a.commodity_number ) AS sort
FROM
	( SELECT commodity_number FROM sys_commodity WHERE company_id = '950872849940217856' ) AS a 
WHERE
	a.commodity_number > ( SELECT IFNULL(max(CAST( commodity_number AS SIGNED )),0)+ 1 FROM ( SELECT commodity_number FROM sys_commodity WHERE company_id = '950872849940217856' ) AS b WHERE commodity_number < a.commodity_number ) 
ORDER BY
	commodity_number ASC;
	

以上是关于mysql 实现序号化数字中 缺失的数字的主要内容,如果未能解决你的问题,请参考以下文章

leetcode268 缺失数字(Easy)

word里怎么把数字序号标在文字的右上角?

leetcode问题:缺失数字

力扣-268.缺失数字 题解

缺失数字(NC101/考察次数Top60/难度简单)

缺失数字(NC101/考察次数Top60/难度简单)