标签:cat from pre substr The substring 开头 字母 when
非字母和非0开头按顺序生成一个不重复的idselect case when max(id) is null then ‘10000001‘ else max(id)+1 end as id from student;
select case when max(id) is null then ‘S10000001‘ else CONCAT(‘S‘,SUBSTRING(max(id),2)+1) end as id from student;
标签:cat from pre substr The substring 开头 字母 when
原文地址:http://blog.51cto.com/1197822/2157676