编写如下代码,使用了with as,但结果是临时表,请问要用什么方法将t表格或t表格里的数据复制到新表?
WITH RECURSIVE t(物流公司名称,省,市,sub,str) as (
SELECT 物流公司名称,省,市,CONCAT(合并停发地,', '),CONCAT(合并停发地,', ')
from tfqc
UNION all
SELECT 物流公司名称,省,市,substr(str,1,instr(str,', ')-1),substr(str,instr(str,', ')+1)
from t where instr(str,', ')>0
)
SELECT 物流公司名称,省,市,LTRIM(sub)
FROM t where instr(LTRIM(sub),', ')=0
ORDER BY 物流公司名称,省,市;