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 实现序号化数字中 缺失的数字
最新推荐文章于 2022-10-08 10:41:27 发布