存储过程自动为一天增加ID

时间:2018-09-11 15:34:16

标签: mysql stored-procedures

我是存储过程的新手。我想基于auto_increment创建1天的 id,最大自动增量应为100 。例如C181109-001,C181109-002,C181109-003,直到100。有关创建方法,都是这样。

1。)如果表中没有create_date,则数字后面的ID创建应从001开始。

2。)如果日期可用,我们应该将ID子字符串化,并获得自动增量值并为该天添加。

以下是我的愿景 值int

Select create_date,id from temperature;
if(create_date)=null
    insert substring(create_date)+001
else
    select substring(id)=get the auto increatment id  
    and the add the value behind + 1

预先感谢

0 个答案:

没有答案
相关问题