Want to Split string in mysql using SUBSTRING_INDEX

后端 未结 1 1833
庸人自扰
庸人自扰 2020-12-21 13:16

I need to assign AAA-BBB-CCC in 3 different MySQL variables.

Here\'s the unsuccessful code:

DELIMITER $$
USE `testdepot`$$
DROP PROC         


        
相关标签:
1条回答
  • 2020-12-21 13:48
    SET @t3 = SUBSTRING_INDEX(SUBSTRING_INDEX(id, '-', -2), '-', 1);
    

    There are other ways to do it, but I find this one quite amusing :)

    0 讨论(0)
提交回复
热议问题