不知道你是什么数据库,我用oracel数据库的方式来进行拆分后,再拼接
1、按换行符号拆分成多行,把它开成多行
2、同时截取第一行的日期出来
3、再通过函数拼接,并且按日期排序后拼接
------------------mysql的语句
select
t2.gruid,
GROUP_CONCAT(t2.com_row ORDER BY t2.日期 SEPARATOR '@' ) as 拼接后
from (
select
tmp.gruid,
tmp.com_row,
str_to_date(replace(replace(replace(replace(substr(tmp.com_row,3,instr(tmp.com_row,' ')-2),' ',''),'年','-'),'月','-'),'日',''),'%Y-%m-%d') as 日期
from (
select
substring_index(
substring_index(
t.com,
'@',
b.help_topic_id + 1
),
'@' ,- 1
) AS com_row,
t.gruid
from (
select 1 as gruid,'1.2022年6月23日 13:34,这是测试的数据,好的1000144不是@2.2022年6月15日 09:30,这是另一个测试责任人@3.2022年6月3日 10:20,我是一个测试第三条数据' as com
) t
JOIN mysql.help_topic b ON b.help_topic_id < (
length(t.com) - length(
REPLACE (t.com, '@', '')) + 1)
) tmp
) t2
