select  concat('substring_index(name,'.',1) as name1',"-",'substring_index(name,':',-1) as name2') as name3 from tb1
这个语句怎么改?
对字段name中值前后连接,例如40019.test;高度:5012米 得到:400019-5012米

解决方案 »

  1.   


    SET @tmp := '40019.test;高度:5012米';
    SELECT CONCAT(SUBSTR(@tmp, 1, INSTR(@tmp, '.')-1), '-', SUBSTR(@tmp, INSTR(@tmp, ':')+1))
      

  2.   

    取表中的字段name中值处理 啊
      

  3.   

    select concat(substring_index(name,'.',1),"-",substring_index(name,':',-1)) as name1 from tb1
      

  4.   

    正解SET @tmp := '40019.test;高度:5012米';
    SELECT CONCAT(SUBSTR(@tmp, 1, INSTR(@tmp, '.')-1), '-', SUBSTR(@tmp, INSTR(@tmp, ':')+1))