非字母和非0开头按顺序生成一个不重复的id
select case when max(id) is null then ‘10000001‘ else max(id)+1 end as id from student;
字母开头按顺序生成一个不重复的id
select case when max(id) is null then ‘S10000001‘ else CONCAT(‘S‘,SUBSTRING(max(id),2)+1) end as id from student;
原文地址:http://blog.51cto.com/1197822/2157676
时间: 2024-10-10 00:58:35