I have an output like 9.23333 9.44444 separated by space in a column.
I want to separate that into two columns like 9.2333 in col a and 9.444 in col b
How can I do that?
Please help me
I have an output like 9.23333 9.44444 separated by space in a column.
I want to separate that into two columns like 9.2333 in col a and 9.444 in col b
How can I do that?
Please help me
you can use the below query (i split my name into 2 rows), you can find my name in bold:
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
goodluck