1.自動獲取最新訂單號ui
select concat('XJDD',DATE_FORMAT(now(),'%Y%m%d'), LPAD((if(max(SUBSTRING(inquirynum FROM 13 FOR 4)) is null,1, max(SUBSTRING(inquirynum FROM 13 FOR 4))+1)),4,'0')) as Newnum from ip_c_inquiry where SUBSTRING(inquirynum FROM 5 FOR 8)=DATE_FORMAT(now(),'%Y%m%d')