Ich habe eine Auswahlabfrage, die mich 8 Spalten bringt:Legen Sie mehrere Spalten in einer MySQL
SELECT
substring_index(`Cuisines`,',',1),
substring_index(substring_index(`Cuisines`,',',-7),',',1),
substring_index(substring_index(`Cuisines`,',',-6),',',1),
substring_index(substring_index(`Cuisines`,',',-5),',',1),
substring_index(substring_index(`Cuisines`,',',-4),',',1),
substring_index(substring_index(`Cuisines`,',',-3),',',1),
substring_index(substring_index(`Cuisines`,',',-2),',',1),
substring_index(substring_index(`Cuisines`,',',-1),',',1)
FROM `dump`)
und ich möchte sie alle in einer einzigen Spalte in einer anderen Tabelle einfügen, so versuche ich, aber zu tun, verschmelzen nicht sie zusammen, sondern jeder in eine neue Zeile gehen würde, also, was ich tun wollte war:
INSERT INTO cuisines(name) VALUES (
(SELECT
substring_index(`Cuisines`,',',1),
substring_index(substring_index(`Cuisines`,',',-7),',',1),
substring_index(substring_index(`Cuisines`,',',-6),',',1),
substring_index(substring_index(`Cuisines`,',',-5),',',1),
substring_index(substring_index(`Cuisines`,',',-4),',',1),
substring_index(substring_index(`Cuisines`,',',-3),',',1),
substring_index(substring_index(`Cuisines`,',',-2),',',1),
substring_index(substring_index(`Cuisines`,',',-1),',',1)
FROM `dump`))
gibt es eine Möglichkeit, dass allein auf MySQL zu tun?
Haben Sie versucht, 'UNION' und eine' SELECT' Abfrage für einen Ihrer Teilstrings zu verwenden? – Moseleyi
Das klingt nach einer schrecklichen Idee – Strawberry