MYSQL 拼接和拆分 查最大值 数值相加

  • 自动添加数据 abstract_object_ukid为主键具有唯一性
    select @test:=max(abstract_object_ukid)+1 from resourcecenter.im_abstract_object; #查到abstract_object_ukid最大值加1
    select @test01:=(CONCAT("网店测试",SUBSTRING(name,5)+1)) from im_abstract_object WHERE ( OWNER_UKID = 910003902 and TYPE = 'H_SHOP' and NAME like '%%' and STATUS = '1' ); #拆分 substring ;concat 拼接
    INSERT INTO databases.tables(abstract_object_ukid, name, type, owner_ukid, introduction, parent_abstract_object_ukid, create_time, update_time, update_user_id, create_user_id, status, unit_ukid) VALUES (@test ,
    @test01, 'H_SHOP', 910003902, NULL, NULL, '2017-09-27 13:03:00', '2017-09-27 13:03:00', NULL, NULL, '1', NULL);

posted on 2018-12-07 20:12  游荡的鱼  阅读(543)  评论(0编辑  收藏  举报

导航