我的输出类似于9.23333 9.44444,以列中的空格分隔。
我想把它分成两列,如col a中的9.2333和col b中的9.444
我该怎么做?
请帮帮我
答案 0 :(得分:0)
你可以使用下面的查询(我将我的名字拆分为2行),你可以用粗体找到我的名字:
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(t.e, ' ', n.n), ' ', -1) value
FROM (select **'jack chalouhy'** e) t CROSS JOIN
(
SELECT a.N + b.N * 10 + 1 n
FROM
(SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) a
,(SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) b
ORDER BY n
) n
WHERE n.n <= 1 + (LENGTH(t.e) - LENGTH(REPLACE(t.e, ' ', '')))
ORDER BY value
古德勒克